Browse Source
* cranelift: Add `f16const` and `f128const` instructions * cranelift: Add constant propagation for `f16` and `f128`pull/8970/head
beetrees
4 months ago
committed by
GitHub
20 changed files with 437 additions and 36 deletions
@ -0,0 +1,53 @@ |
|||
test interpret |
|||
|
|||
|
|||
;; These values are special for RISC-V since it has a dedicated |
|||
;; instruction to generate them. |
|||
|
|||
function %special_f128_values() -> f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128, f128 { |
|||
block0: |
|||
v0 = f128const -0x1.p0 |
|||
v1 = f128const 0x1.p-16382 |
|||
v2 = f128const 0x1.p-16 |
|||
v3 = f128const 0x1.p-15 |
|||
v4 = f128const 0x1.p-8 |
|||
v5 = f128const 0x1.p-7 |
|||
v6 = f128const 0x1.p-4 |
|||
v7 = f128const 0x1.p-3 |
|||
v8 = f128const 0x1.p-2 |
|||
v9 = f128const 0x1.4p-2 |
|||
v10 = f128const 0x1.8p-2 |
|||
v11 = f128const 0x1.cp-2 |
|||
v12 = f128const 0x1.p-1 |
|||
v13 = f128const 0x1.4p-1 |
|||
v14 = f128const 0x1.8p-1 |
|||
v15 = f128const 0x1.cp-1 |
|||
v16 = f128const 0x1.p0 |
|||
v17 = f128const 0x1.4p0 |
|||
v18 = f128const 0x1.8p0 |
|||
v19 = f128const 0x1.cp0 |
|||
v20 = f128const 0x1.p1 |
|||
v21 = f128const 0x1.4p1 |
|||
v22 = f128const 0x1.8p1 |
|||
v23 = f128const 0x1.p2 |
|||
v24 = f128const 0x1.p3 |
|||
v25 = f128const 0x1.p4 |
|||
v26 = f128const 0x1.p7 |
|||
v27 = f128const 0x1.p8 |
|||
v28 = f128const 0x1.p15 |
|||
v29 = f128const 0x1.p16 |
|||
v30 = f128const +Inf |
|||
v31 = f128const +NaN |
|||
|
|||
return v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31 |
|||
} |
|||
|
|||
; run: %special_f128_values() == [-0x1.p0, 0x1.p-16382, 0x1.p-16, 0x1.p-15, 0x1.p-8, 0x1.p-7, 0x1.p-4, 0x1.p-3, 0x1.p-2, 0x1.4p-2, 0x1.8p-2, 0x1.cp-2, 0x1.p-1, 0x1.4p-1, 0x1.8p-1, 0x1.cp-1, 0x1.p0, 0x1.4p0, 0x1.8p0, 0x1.cp0, 0x1.p1, 0x1.4p1, 0x1.8p1, 0x1.p2, 0x1.p3, 0x1.p4, 0x1.p7, 0x1.p8, 0x1.p15, 0x1.p16, +Inf, +NaN] |
|||
|
|||
function %f128const_neg_nan() -> f128 { |
|||
block0: |
|||
v0 = f128const -NaN |
|||
return v0 |
|||
} |
|||
|
|||
; run: %f128const_neg_nan() == -NaN |
@ -0,0 +1,53 @@ |
|||
test interpret |
|||
|
|||
|
|||
;; These values are special for RISC-V since it has a dedicated |
|||
;; instruction to generate them. |
|||
|
|||
function %special_f16_values() -> f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16, f16 { |
|||
block0: |
|||
v0 = f16const -0x1.p0 |
|||
v1 = f16const 0x1.p-14 |
|||
v2 = f16const 0x1.p-16 |
|||
v3 = f16const 0x1.p-15 |
|||
v4 = f16const 0x1.p-8 |
|||
v5 = f16const 0x1.p-7 |
|||
v6 = f16const 0x1.p-4 |
|||
v7 = f16const 0x1.p-3 |
|||
v8 = f16const 0x1.p-2 |
|||
v9 = f16const 0x1.4p-2 |
|||
v10 = f16const 0x1.8p-2 |
|||
v11 = f16const 0x1.cp-2 |
|||
v12 = f16const 0x1.p-1 |
|||
v13 = f16const 0x1.4p-1 |
|||
v14 = f16const 0x1.8p-1 |
|||
v15 = f16const 0x1.cp-1 |
|||
v16 = f16const 0x1.p0 |
|||
v17 = f16const 0x1.4p0 |
|||
v18 = f16const 0x1.8p0 |
|||
v19 = f16const 0x1.cp0 |
|||
v20 = f16const 0x1.p1 |
|||
v21 = f16const 0x1.4p1 |
|||
v22 = f16const 0x1.8p1 |
|||
v23 = f16const 0x1.p2 |
|||
v24 = f16const 0x1.p3 |
|||
v25 = f16const 0x1.p4 |
|||
v26 = f16const 0x1.p7 |
|||
v27 = f16const 0x1.p8 |
|||
v28 = f16const 0x1.p15 |
|||
v29 = f16const +Inf |
|||
v30 = f16const +NaN |
|||
|
|||
return v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30 |
|||
} |
|||
|
|||
; run: %special_f16_values() == [-0x1.p0, 0x1.p-14, 0x1.p-16, 0x1.p-15, 0x1.p-8, 0x1.p-7, 0x1.p-4, 0x1.p-3, 0x1.p-2, 0x1.4p-2, 0x1.8p-2, 0x1.cp-2, 0x1.p-1, 0x1.4p-1, 0x1.8p-1, 0x1.cp-1, 0x1.p0, 0x1.4p0, 0x1.8p0, 0x1.cp0, 0x1.p1, 0x1.4p1, 0x1.8p1, 0x1.p2, 0x1.p3, 0x1.p4, 0x1.p7, 0x1.p8, 0x1.p15, +Inf, +NaN] |
|||
|
|||
|
|||
function %f16const_neg_nan() -> f16 { |
|||
block0: |
|||
v0 = f16const -NaN |
|||
return v0 |
|||
} |
|||
|
|||
; run: %f16const_neg_nan() == -NaN |
Loading…
Reference in new issue