From ef9f0202c1acae915f02ee2b39ab92981f800297 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Tue, 21 Dec 2021 11:37:20 +0000 Subject: Define semantics for vmulh. --- src/Helium/Semantics/Denotational.agda | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Helium/Semantics/Denotational.agda') diff --git a/src/Helium/Semantics/Denotational.agda b/src/Helium/Semantics/Denotational.agda index 93c784c..2cf1607 100644 --- a/src/Helium/Semantics/Denotational.agda +++ b/src/Helium/Semantics/Denotational.agda @@ -161,3 +161,15 @@ module _ vmul : VMul → Procedure 2 (Beat , ElmtMask , _) vmul d = vec-op₂ d (λ x y → sliceᶻ _ zero (sint x *ᶻ sint y)) + + vmulh : VMulH → Procedure 2 (Beat , ElmtMask , _) + vmulh d = vec-op₂ op₂ (λ x y → cast (eq _ esize) (sliceᶻ 2esize esize′ (int x *ᶻ int y +ᶻ rval))) + where + open VMulH d + int = Bool.if unsigned then uint else sint + rval = Bool.if rounding then 1ℤ << toℕ esize-1 else 0ℤ + 2esize = toℕ esize + toℕ esize + esize′ = inject+ _ (strengthen esize) + eq : ∀ {n} m (i : Fin n) → toℕ i + m ℕ-ℕ inject+ m (strengthen i) ≡ m + eq m zero = refl + eq m (suc i) = eq m i -- cgit v1.2.3