Skip to content

Commit 27a8501

Browse files
authored
[msan][NFC] Add f16c-intrinsics.ll tests (#129807)
Forked from llvm/test/CodeGen/X86/f16c-intrinsics.ll Handled by visitInstruction: - llvm.x86.vcvtps2ph.128/256
1 parent c1468e9 commit 27a8501

File tree

1 file changed

+204
-0
lines changed

1 file changed

+204
-0
lines changed
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -passes=msan -S | FileCheck %s
3+
;
4+
; Forked from llvm/test/CodeGen/X86/f16c-intrinsics.ll
5+
;
6+
; Handled by visitInstruction:
7+
; - llvm.x86.vcvtps2ph.128/256
8+
9+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
10+
target triple = "x86_64-unknown-linux-gnu"
11+
12+
define <8 x i16> @test_x86_vcvtps2ph_128(<4 x float> %a0) #0 {
13+
; CHECK-LABEL: define <8 x i16> @test_x86_vcvtps2ph_128(
14+
; CHECK-SAME: <4 x float> [[A0:%.*]]) #[[ATTR0:[0-9]+]] {
15+
; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr @__msan_param_tls, align 8
16+
; CHECK-NEXT: call void @llvm.donothing()
17+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i32> [[TMP1]] to i128
18+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i128 [[TMP2]], 0
19+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1:![0-9]+]]
20+
; CHECK: [[BB3]]:
21+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4:[0-9]+]]
22+
; CHECK-NEXT: unreachable
23+
; CHECK: [[BB4]]:
24+
; CHECK-NEXT: [[RES:%.*]] = call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> [[A0]], i32 0)
25+
; CHECK-NEXT: store <8 x i16> zeroinitializer, ptr @__msan_retval_tls, align 8
26+
; CHECK-NEXT: ret <8 x i16> [[RES]]
27+
;
28+
%res = call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %a0, i32 0) ; <<8 x i16>> [#uses=1]
29+
ret <8 x i16> %res
30+
}
31+
declare <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float>, i32) nounwind readonly
32+
33+
define <8 x i16> @test_x86_vcvtps2ph_256(<8 x float> %a0) #0 {
34+
; CHECK-LABEL: define <8 x i16> @test_x86_vcvtps2ph_256(
35+
; CHECK-SAME: <8 x float> [[A0:%.*]]) #[[ATTR0]] {
36+
; CHECK-NEXT: [[TMP1:%.*]] = load <8 x i32>, ptr @__msan_param_tls, align 8
37+
; CHECK-NEXT: call void @llvm.donothing()
38+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i32> [[TMP1]] to i256
39+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i256 [[TMP2]], 0
40+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1]]
41+
; CHECK: [[BB3]]:
42+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
43+
; CHECK-NEXT: unreachable
44+
; CHECK: [[BB4]]:
45+
; CHECK-NEXT: [[RES:%.*]] = call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> [[A0]], i32 0)
46+
; CHECK-NEXT: store <8 x i16> zeroinitializer, ptr @__msan_retval_tls, align 8
47+
; CHECK-NEXT: ret <8 x i16> [[RES]]
48+
;
49+
%res = call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> %a0, i32 0) ; <<8 x i16>> [#uses=1]
50+
ret <8 x i16> %res
51+
}
52+
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readonly
53+
54+
55+
define void @test_x86_vcvtps2ph_256_m(ptr nocapture %d, <8 x float> %a) nounwind #0 {
56+
; CHECK-LABEL: define void @test_x86_vcvtps2ph_256_m(
57+
; CHECK-SAME: ptr captures(none) [[D:%.*]], <8 x float> [[A:%.*]]) #[[ATTR2:[0-9]+]] {
58+
; CHECK-NEXT: [[ENTRY:.*:]]
59+
; CHECK-NEXT: [[TMP17:%.*]] = load <8 x i32>, ptr inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), align 8
60+
; CHECK-NEXT: [[TMP18:%.*]] = load i64, ptr @__msan_param_tls, align 8
61+
; CHECK-NEXT: call void @llvm.donothing()
62+
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <8 x i32> [[TMP17]] to i256
63+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i256 [[TMP4]], 0
64+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1]]
65+
; CHECK: [[BB3]]:
66+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
67+
; CHECK-NEXT: unreachable
68+
; CHECK: [[BB4]]:
69+
; CHECK-NEXT: [[TMP0:%.*]] = tail call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> [[A]], i32 3)
70+
; CHECK-NEXT: [[_MSCMP1:%.*]] = icmp ne i64 [[TMP18]], 0
71+
; CHECK-NEXT: br i1 [[_MSCMP1]], label %[[BB6:.*]], label %[[BB7:.*]], !prof [[PROF1]]
72+
; CHECK: [[BB6]]:
73+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
74+
; CHECK-NEXT: unreachable
75+
; CHECK: [[BB7]]:
76+
; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[D]] to i64
77+
; CHECK-NEXT: [[TMP2:%.*]] = xor i64 [[TMP1]], 87960930222080
78+
; CHECK-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
79+
; CHECK-NEXT: store <8 x i16> zeroinitializer, ptr [[TMP3]], align 16
80+
; CHECK-NEXT: store <8 x i16> [[TMP0]], ptr [[D]], align 16
81+
; CHECK-NEXT: ret void
82+
;
83+
entry:
84+
%0 = tail call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> %a, i32 3)
85+
store <8 x i16> %0, ptr %d, align 16
86+
ret void
87+
}
88+
89+
define void @test_x86_vcvtps2ph_128_m(ptr nocapture %d, <4 x float> %a) nounwind #0 {
90+
; CHECK-LABEL: define void @test_x86_vcvtps2ph_128_m(
91+
; CHECK-SAME: ptr captures(none) [[D:%.*]], <4 x float> [[A:%.*]]) #[[ATTR2]] {
92+
; CHECK-NEXT: [[ENTRY:.*:]]
93+
; CHECK-NEXT: [[TMP9:%.*]] = load <4 x i32>, ptr inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), align 8
94+
; CHECK-NEXT: [[TMP10:%.*]] = load i64, ptr @__msan_param_tls, align 8
95+
; CHECK-NEXT: call void @llvm.donothing()
96+
; CHECK-NEXT: [[TMP5:%.*]] = bitcast <4 x i32> [[TMP9]] to i128
97+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i128 [[TMP5]], 0
98+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1]]
99+
; CHECK: [[BB3]]:
100+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
101+
; CHECK-NEXT: unreachable
102+
; CHECK: [[BB4]]:
103+
; CHECK-NEXT: [[TMP0:%.*]] = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> [[A]], i32 3)
104+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x i16> [[TMP0]], <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
105+
; CHECK-NEXT: [[_MSCMP1:%.*]] = icmp ne i64 [[TMP10]], 0
106+
; CHECK-NEXT: br i1 [[_MSCMP1]], label %[[BB7:.*]], label %[[BB8:.*]], !prof [[PROF1]]
107+
; CHECK: [[BB7]]:
108+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
109+
; CHECK-NEXT: unreachable
110+
; CHECK: [[BB8]]:
111+
; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[D]] to i64
112+
; CHECK-NEXT: [[TMP3:%.*]] = xor i64 [[TMP2]], 87960930222080
113+
; CHECK-NEXT: [[TMP4:%.*]] = inttoptr i64 [[TMP3]] to ptr
114+
; CHECK-NEXT: store <4 x i16> zeroinitializer, ptr [[TMP4]], align 8
115+
; CHECK-NEXT: store <4 x i16> [[TMP1]], ptr [[D]], align 8
116+
; CHECK-NEXT: ret void
117+
;
118+
entry:
119+
%0 = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %a, i32 3)
120+
%1 = shufflevector <8 x i16> %0, <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
121+
store <4 x i16> %1, ptr %d, align 8
122+
ret void
123+
}
124+
125+
define void @test_x86_vcvtps2ph_128_m2(ptr nocapture %hf4x16, <4 x float> %f4X86) #0 {
126+
; CHECK-LABEL: define void @test_x86_vcvtps2ph_128_m2(
127+
; CHECK-SAME: ptr captures(none) [[HF4X16:%.*]], <4 x float> [[F4X86:%.*]]) #[[ATTR0]] {
128+
; CHECK-NEXT: [[ENTRY:.*:]]
129+
; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), align 8
130+
; CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr @__msan_param_tls, align 8
131+
; CHECK-NEXT: call void @llvm.donothing()
132+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i32> [[TMP0]] to i128
133+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i128 [[TMP2]], 0
134+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1]]
135+
; CHECK: [[BB3]]:
136+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
137+
; CHECK-NEXT: unreachable
138+
; CHECK: [[BB4]]:
139+
; CHECK-NEXT: [[TMP11:%.*]] = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> [[F4X86]], i32 3)
140+
; CHECK-NEXT: [[TMP12:%.*]] = bitcast <8 x i16> [[TMP11]] to <2 x double>
141+
; CHECK-NEXT: [[VECEXT:%.*]] = extractelement <2 x double> [[TMP12]], i32 0
142+
; CHECK-NEXT: [[_MSCMP1:%.*]] = icmp ne i64 [[TMP1]], 0
143+
; CHECK-NEXT: br i1 [[_MSCMP1]], label %[[BB7:.*]], label %[[BB8:.*]], !prof [[PROF1]]
144+
; CHECK: [[BB7]]:
145+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
146+
; CHECK-NEXT: unreachable
147+
; CHECK: [[BB8]]:
148+
; CHECK-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[HF4X16]] to i64
149+
; CHECK-NEXT: [[TMP16:%.*]] = xor i64 [[TMP15]], 87960930222080
150+
; CHECK-NEXT: [[TMP17:%.*]] = inttoptr i64 [[TMP16]] to ptr
151+
; CHECK-NEXT: store i64 0, ptr [[TMP17]], align 8
152+
; CHECK-NEXT: store double [[VECEXT]], ptr [[HF4X16]], align 8
153+
; CHECK-NEXT: ret void
154+
;
155+
entry:
156+
%0 = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %f4X86, i32 3)
157+
%1 = bitcast <8 x i16> %0 to <2 x double>
158+
%vecext = extractelement <2 x double> %1, i32 0
159+
store double %vecext, ptr %hf4x16, align 8
160+
ret void
161+
}
162+
163+
define void @test_x86_vcvtps2ph_128_m3(ptr nocapture %hf4x16, <4 x float> %f4X86) #0 {
164+
; CHECK-LABEL: define void @test_x86_vcvtps2ph_128_m3(
165+
; CHECK-SAME: ptr captures(none) [[HF4X16:%.*]], <4 x float> [[F4X86:%.*]]) #[[ATTR0]] {
166+
; CHECK-NEXT: [[ENTRY:.*:]]
167+
; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr inttoptr (i64 add (i64 ptrtoint (ptr @__msan_param_tls to i64), i64 8) to ptr), align 8
168+
; CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr @__msan_param_tls, align 8
169+
; CHECK-NEXT: call void @llvm.donothing()
170+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i32> [[TMP0]] to i128
171+
; CHECK-NEXT: [[_MSCMP:%.*]] = icmp ne i128 [[TMP2]], 0
172+
; CHECK-NEXT: br i1 [[_MSCMP]], label %[[BB3:.*]], label %[[BB4:.*]], !prof [[PROF1]]
173+
; CHECK: [[BB3]]:
174+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
175+
; CHECK-NEXT: unreachable
176+
; CHECK: [[BB4]]:
177+
; CHECK-NEXT: [[TMP11:%.*]] = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> [[F4X86]], i32 3)
178+
; CHECK-NEXT: [[TMP12:%.*]] = bitcast <8 x i16> [[TMP11]] to <2 x i64>
179+
; CHECK-NEXT: [[VECEXT:%.*]] = extractelement <2 x i64> [[TMP12]], i32 0
180+
; CHECK-NEXT: [[_MSCMP1:%.*]] = icmp ne i64 [[TMP1]], 0
181+
; CHECK-NEXT: br i1 [[_MSCMP1]], label %[[BB7:.*]], label %[[BB8:.*]], !prof [[PROF1]]
182+
; CHECK: [[BB7]]:
183+
; CHECK-NEXT: call void @__msan_warning_noreturn() #[[ATTR4]]
184+
; CHECK-NEXT: unreachable
185+
; CHECK: [[BB8]]:
186+
; CHECK-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[HF4X16]] to i64
187+
; CHECK-NEXT: [[TMP16:%.*]] = xor i64 [[TMP15]], 87960930222080
188+
; CHECK-NEXT: [[TMP17:%.*]] = inttoptr i64 [[TMP16]] to ptr
189+
; CHECK-NEXT: store i64 0, ptr [[TMP17]], align 8
190+
; CHECK-NEXT: store i64 [[VECEXT]], ptr [[HF4X16]], align 8
191+
; CHECK-NEXT: ret void
192+
;
193+
entry:
194+
%0 = tail call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %f4X86, i32 3)
195+
%1 = bitcast <8 x i16> %0 to <2 x i64>
196+
%vecext = extractelement <2 x i64> %1, i32 0
197+
store i64 %vecext, ptr %hf4x16, align 8
198+
ret void
199+
}
200+
201+
attributes #0 = { sanitize_memory }
202+
;.
203+
; CHECK: [[PROF1]] = !{!"branch_weights", i32 1, i32 1048575}
204+
;.

0 commit comments

Comments
 (0)