Skip to content

Commit 33e285c

Browse files
committed
Precommit test for relaxed min max
1 parent 56e3e30 commit 33e285c

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
3+
; RUN: llc < %s -mtriple=wasm32-unknown-unknown -mattr=+simd128,+relaxed-simd | FileCheck %s
4+
5+
; Test that fminimum and fmaximum get transformed to relaxed_min and relaxed_max
6+
7+
target triple = "wasm32"
8+
9+
define <4 x float> @test_max_f32x4(<4 x float> %a, <4 x float> %b) {
10+
; CHECK-LABEL: test_max_f32x4:
11+
; CHECK: .functype test_max_f32x4 (v128, v128) -> (v128)
12+
; CHECK-NEXT: # %bb.0:
13+
; CHECK-NEXT: local.get 0
14+
; CHECK-NEXT: local.get 1
15+
; CHECK-NEXT: f32x4.max
16+
; CHECK-NEXT: # fallthrough-return
17+
%result = call <4 x float> @llvm.maximum.v4f32(<4 x float> %a, <4 x float> %b)
18+
ret <4 x float> %result
19+
}
20+
21+
22+
define <2 x double> @test_max_f64x2(<2 x double> %a, <2 x double> %b) {
23+
; CHECK-LABEL: test_max_f64x2:
24+
; CHECK: .functype test_max_f64x2 (v128, v128) -> (v128)
25+
; CHECK-NEXT: # %bb.0:
26+
; CHECK-NEXT: local.get 0
27+
; CHECK-NEXT: local.get 1
28+
; CHECK-NEXT: f64x2.max
29+
; CHECK-NEXT: # fallthrough-return
30+
%result = call <2 x double> @llvm.maximum.v2f64(<2 x double> %a, <2 x double> %b)
31+
ret <2 x double> %result
32+
}
33+
34+
declare <4 x float> @llvm.maximum.v4f32(<4 x float>, <4 x float>)
35+
declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: llc < %s -mtriple=wasm32-unknown-unknown -mattr=+simd128,+relaxed-simd | FileCheck %s
3+
4+
; Test that fminimum and fmaximum get transformed to relaxed_min and relaxed_max
5+
6+
target triple = "wasm32"
7+
8+
define <4 x float> @test_min_f32x4(<4 x float> %a, <4 x float> %b) {
9+
; CHECK-LABEL: test_min_f32x4:
10+
; CHECK: .functype test_min_f32x4 (v128, v128) -> (v128)
11+
; CHECK-NEXT: # %bb.0:
12+
; CHECK-NEXT: local.get 0
13+
; CHECK-NEXT: local.get 1
14+
; CHECK-NEXT: f32x4.min
15+
; CHECK-NEXT: # fallthrough-return
16+
%result = call <4 x float> @llvm.minimum.v4f32(<4 x float> %a, <4 x float> %b)
17+
ret <4 x float> %result
18+
}
19+
20+
21+
define <2 x double> @test_min_f64x2(<2 x double> %a, <2 x double> %b) {
22+
; CHECK-LABEL: test_min_f64x2:
23+
; CHECK: .functype test_min_f64x2 (v128, v128) -> (v128)
24+
; CHECK-NEXT: # %bb.0:
25+
; CHECK-NEXT: local.get 0
26+
; CHECK-NEXT: local.get 1
27+
; CHECK-NEXT: f64x2.min
28+
; CHECK-NEXT: # fallthrough-return
29+
%result = call <2 x double> @llvm.minimum.v2f64(<2 x double> %a, <2 x double> %b)
30+
ret <2 x double> %result
31+
}
32+
33+
declare <4 x float> @llvm.minimum.v4f32(<4 x float>, <4 x float>)
34+
declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)

0 commit comments

Comments
 (0)