Skip to content

Commit 3f305fd

Browse files
committed
Add test case for x86 maxnum
Should be profitable on AVX2 but not SSE2
1 parent 50789af commit 3f305fd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -S -p vector-combine -mtriple=x86_64 -mattr=sse2 | FileCheck %s --check-prefixes=CHECK,SSE2
3+
; RUN: opt < %s -S -p vector-combine -mtriple=x86_64 -mattr=avx2 | FileCheck %s --check-prefixes=CHECK,AVX2
4+
5+
define <2 x float> @maxnum(float %x, float %y) {
6+
; SSE2-LABEL: define <2 x float> @maxnum(
7+
; SSE2-SAME: float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
8+
; SSE2-NEXT: [[X_INSERT:%.*]] = insertelement <2 x float> poison, float [[X]], i32 0
9+
; SSE2-NEXT: [[Y_INSERT:%.*]] = insertelement <2 x float> poison, float [[Y]], i32 0
10+
; SSE2-NEXT: [[V:%.*]] = call <2 x float> @llvm.maxnum.v2f32(<2 x float> [[X_INSERT]], <2 x float> [[Y_INSERT]])
11+
; SSE2-NEXT: ret <2 x float> [[V]]
12+
;
13+
; AVX2-LABEL: define <2 x float> @maxnum(
14+
; AVX2-SAME: float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
15+
; AVX2-NEXT: [[V_SCALAR:%.*]] = call float @llvm.maxnum.f32(float [[X]], float [[Y]])
16+
; AVX2-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.maxnum.v2f32(<2 x float> poison, <2 x float> poison)
17+
; AVX2-NEXT: [[V:%.*]] = insertelement <2 x float> [[TMP1]], float [[V_SCALAR]], i64 0
18+
; AVX2-NEXT: ret <2 x float> [[V]]
19+
;
20+
%x.insert = insertelement <2 x float> poison, float %x, i32 0
21+
%y.insert = insertelement <2 x float> poison, float %y, i32 0
22+
%v = call <2 x float> @llvm.maxnum(<2 x float> %x.insert, <2 x float> %y.insert)
23+
ret <2 x float> %v
24+
}
25+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
26+
; CHECK: {{.*}}

0 commit comments

Comments
 (0)