summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast')
-rw-r--r--test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast b/test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast
new file mode 100644
index 000000000..d3e759e1c
--- /dev/null
+++ b/test/lit/passes/optimize-instructions-nontrapping-float-to-int.wast
@@ -0,0 +1,77 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s --optimize-instructions --enable-nontrapping-float-to-int -S -o - | filecheck %s
+
+(module
+ (memory 0)
+
+ ;; CHECK: (func $simplify_int_float_sat_conversion_roundtrips (param $x i32) (param $y i64)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.trunc_sat_f64_s
+ ;; CHECK-NEXT: (f64.convert_i32_u
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.trunc_sat_f64_u
+ ;; CHECK-NEXT: (f64.convert_i32_s
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.trunc_sat_f32_u
+ ;; CHECK-NEXT: (f32.convert_i32_u
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.trunc_sat_f64_u
+ ;; CHECK-NEXT: (f64.convert_i64_u
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.trunc_sat_f64_s
+ ;; CHECK-NEXT: (f64.convert_i64_s
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.trunc_sat_f32_u
+ ;; CHECK-NEXT: (f32.convert_i32_s
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.trunc_sat_f32_s
+ ;; CHECK-NEXT: (f32.convert_i64_s
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $simplify_int_float_sat_conversion_roundtrips (param $x i32) (param $y i64)
+ (drop (i32.trunc_sat_f64_u (f64.convert_i32_u (local.get $x))))
+ (drop (i32.trunc_sat_f64_s (f64.convert_i32_s (local.get $x))))
+
+ ;; skips
+ (drop (i32.trunc_sat_f64_s (f64.convert_i32_u (local.get $x))))
+ (drop (i32.trunc_sat_f64_u (f64.convert_i32_s (local.get $x))))
+ (drop (i32.trunc_sat_f32_u (f32.convert_i32_u (local.get $x))))
+ (drop (i32.trunc_sat_f64_u (f64.convert_i64_u (local.get $y))))
+ (drop (i64.trunc_sat_f64_s (f64.convert_i64_s (local.get $y))))
+ (drop (i64.trunc_sat_f32_u (f32.convert_i32_s (local.get $x))))
+ (drop (i64.trunc_sat_f32_s (f32.convert_i64_s (local.get $y))))
+ )
+)