Skip to content

Commit 22e408b

Browse files
committed
pulley: Finish simd proposal implementation
This commit fills out the final and miscellaneous set of opcodes for Pulley to have a complete implementation of the `simd` proposal for WebAssembly. All spec tests are now enabled and the Pulley-specific exceptions for `*.wast` tests are all gone. Closes #9783
1 parent fc3c868 commit 22e408b

52 files changed

Lines changed: 313 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cranelift/codegen/src/isa/pulley_shared/lower.isle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,9 @@
985985
(rule 1 (lower (has_type $F64 (select c a b)))
986986
(pulley_fselect64 (emit_cond (lower_cond c)) a b))
987987

988+
(rule 2 (lower (has_type (ty_vec128 _) (select c a b)))
989+
(pulley_vselect (emit_cond (lower_cond c)) a b))
990+
988991
;; Helper to emit a conditional into a register itself.
989992
(decl emit_cond (Cond) XReg)
990993
(rule (emit_cond (Cond.If32 reg)) reg)
@@ -1157,6 +1160,18 @@
11571160
(rule (lower (has_type $I64 (fcvt_to_sint_sat val @ (value_type $F64))))
11581161
(pulley_x64_from_f64_s_sat val))
11591162

1163+
(rule (lower (has_type $I32X4 (fcvt_to_sint_sat val @ (value_type $F32X4))))
1164+
(pulley_vi32x4_from_f32x4_s val))
1165+
1166+
(rule (lower (has_type $I32X4 (fcvt_to_uint_sat val @ (value_type $F32X4))))
1167+
(pulley_vi32x4_from_f32x4_u val))
1168+
1169+
(rule (lower (has_type $I64X2 (fcvt_to_sint_sat val @ (value_type $F64X2))))
1170+
(pulley_vi64x2_from_f64x2_s val))
1171+
1172+
(rule (lower (has_type $I64X2 (fcvt_to_uint_sat val @ (value_type $F64X2))))
1173+
(pulley_vi64x2_from_f64x2_u val))
1174+
11601175
;;;; Rules for `fdemote` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11611176

11621177
(rule (lower (has_type $F32 (fdemote val @ (value_type $F64))))
@@ -1373,12 +1388,17 @@
13731388

13741389
(rule (lower (snarrow a @ (value_type $I16X8) b)) (pulley_vnarrow16x8_s a b))
13751390
(rule (lower (snarrow a @ (value_type $I32X4) b)) (pulley_vnarrow32x4_s a b))
1391+
(rule (lower (snarrow a @ (value_type $I64X2) b)) (pulley_vnarrow64x2_s a b))
13761392

13771393
;;;; Rules for `unarrow` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13781394

13791395
(rule (lower (unarrow a @ (value_type $I16X8) b)) (pulley_vnarrow16x8_u a b))
13801396
(rule (lower (unarrow a @ (value_type $I32X4) b)) (pulley_vnarrow32x4_u a b))
13811397

1398+
;;;; Rules for `uunarrow` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1399+
1400+
(rule (lower (uunarrow a @ (value_type $I64X2) b)) (pulley_vunarrow64x2_u a b))
1401+
13821402
;;;; Rules for `fvpromote_low` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13831403

13841404
(rule (lower (fvpromote_low a @ (value_type $F32X4))) (pulley_vfpromotelow a))

cranelift/filetests/filetests/runtests/simd-arithmetic.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ target x86_64 sse42 has_avx
99
set enable_multi_ret_implicit_sret
1010
target riscv64 has_v
1111
target riscv64 has_v has_c has_zcb
12+
target pulley32
13+
target pulley32be
14+
target pulley64
15+
target pulley64be
1216

1317

1418
function %sadd_sat_i8x16(i8x16, i8x16) -> i8x16 {

cranelift/filetests/filetests/runtests/simd-avg-round.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ target x86_64 skylake
66
set enable_multi_ret_implicit_sret
77
target riscv64 has_v
88
target riscv64 has_v has_c has_zcb
9+
target pulley32
10+
target pulley32be
11+
target pulley64
12+
target pulley64be
913

1014
function %average_rounding_i8x16(i8x16, i8x16) -> i8x16 {
1115
block0(v0: i8x16, v1: i8x16):

cranelift/filetests/filetests/runtests/simd-band-splat.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ target x86_64 sse42 has_avx
99
set enable_multi_ret_implicit_sret
1010
target riscv64 has_v
1111
target riscv64 has_v has_c has_zcb
12+
target pulley32
13+
target pulley32be
14+
target pulley64
15+
target pulley64be
1216

1317
function %band_splat_const_i8x16(i8x16) -> i8x16 {
1418
block0(v0: i8x16):

cranelift/filetests/filetests/runtests/simd-bitcast.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ target s390x
77
set enable_multi_ret_implicit_sret
88
target riscv64 has_v
99
target riscv64 has_v has_c has_zcb
10+
target pulley32
11+
target pulley32be
12+
target pulley64
13+
target pulley64be
1014

1115
function %bitcast_if32x4(i32x4) -> f32x4 {
1216
block0(v0: i32x4):

cranelift/filetests/filetests/runtests/simd-bitselect-to-vselect.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ target x86_64 skylake
77
set enable_multi_ret_implicit_sret
88
target riscv64 has_v
99
target riscv64 has_v has_c has_zcb
10+
target pulley32
11+
target pulley32be
12+
target pulley64
13+
target pulley64be
1014

1115
function %mask_from_icmp(i32x4, i32x4) -> i32x4 {
1216
block0(v0: i32x4, v1: i32x4):

cranelift/filetests/filetests/runtests/simd-bitselect.clif

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ set enable_multi_ret_implicit_sret
77
target riscv64 has_v
88
target riscv64 has_v has_c has_zcb
99
set enable_multi_ret_implicit_sret=false
10+
target pulley32
11+
target pulley32be
12+
target pulley64
13+
target pulley64be
1014

1115
set opt_level=speed
1216
target aarch64
@@ -16,6 +20,10 @@ target x86_64 has_sse3 has_ssse3 has_sse41 has_avx
1620
set enable_multi_ret_implicit_sret
1721
target riscv64 has_v
1822
target riscv64 has_v has_c has_zcb
23+
target pulley32
24+
target pulley32be
25+
target pulley64
26+
target pulley64be
1927

2028
function %bitselect_i64x2(i64x2, i64x2, i64x2) -> i64x2 {
2129
block0(v0: i64x2, v1: i64x2, v2: i64x2):

cranelift/filetests/filetests/runtests/simd-bor-splat.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ target x86_64 sse42 has_avx
88
set enable_multi_ret_implicit_sret
99
target riscv64 has_v
1010
target riscv64 has_v has_c has_zcb
11+
target pulley32
12+
target pulley32be
13+
target pulley64
14+
target pulley64be
1115

1216
function %bor_splat_const_i8x16(i8x16) -> i8x16 {
1317
block0(v0: i8x16):

cranelift/filetests/filetests/runtests/simd-bxor-splat.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ target x86_64 sse42 has_avx
99
set enable_multi_ret_implicit_sret
1010
target riscv64 has_v
1111
target riscv64 has_v has_c has_zcb
12+
target pulley32
13+
target pulley32be
14+
target pulley64
15+
target pulley64be
1216

1317
function %bxor_splat_const_i8x16(i8x16) -> i8x16 {
1418
block0(v0: i8x16):

cranelift/filetests/filetests/runtests/simd-ceil.clif

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ target s390x
99
set enable_multi_ret_implicit_sret
1010
target riscv64 has_v
1111
target riscv64 has_v has_c has_zcb
12+
target pulley32
13+
target pulley32be
14+
target pulley64
15+
target pulley64be
1216

1317
function %ceil_f32x4(f32x4) -> f32x4 {
1418
block0(v0: f32x4):

0 commit comments

Comments
 (0)