xref: /aosp_15_r20/external/llvm/test/Instrumentation/MemorySanitizer/vector_cmp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
2
3target 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"
4target triple = "x86_64-unknown-linux-gnu"
5
6declare <4 x float> @llvm.x86.sse.cmp.ss(<4 x float>, <4 x float>, i8) nounwind readnone
7declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone
8declare <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double>, <2 x double>, i8) nounwind readnone
9declare i32 @llvm.x86.sse.comineq.ss(<4 x float>, <4 x float>) nounwind readnone
10declare i32 @llvm.x86.sse2.ucomilt.sd(<2 x double>, <2 x double>) nounwind readnone
11
12
13define <4 x float> @test_sse_cmp_ss(<4 x float> %a, <4 x float> %b) sanitize_memory {
14entry:
15  %0 = tail call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %a, <4 x float> %b, i8 4)
16  ret <4 x float> %0
17}
18
19; CHECK-LABEL: @test_sse_cmp_ss
20; CHECK: %[[A:.*]] = or <4 x i32>
21; CHECK: %[[B:.*]] = extractelement <4 x i32> %[[A]], i64 0
22; CHECK: %[[C:.*]] = icmp ne i32 %[[B]], 0
23; CHECK: %[[D:.*]] = sext i1 %[[C]] to i128
24; CHECK: %[[E:.*]] = bitcast i128 %[[D]] to <4 x i32>
25; CHECK: store <4 x i32> %[[E]]
26
27
28define <4 x float> @test_sse_cmp_ps(<4 x float> %a, <4 x float> %b) sanitize_memory {
29entry:
30  %0 = tail call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %a, <4 x float> %b, i8 4)
31  ret <4 x float> %0
32}
33
34; CHECK-LABEL: @test_sse_cmp_ps
35; CHECK: %[[A:.*]] = or <4 x i32>
36; CHECK: %[[B:.*]] = icmp ne <4 x i32> %[[A]], zeroinitializer
37; CHECK: %[[C:.*]] = sext <4 x i1> %[[B]] to <4 x i32>
38; CHECK: store <4 x i32> %[[C]]
39
40
41define <2 x double> @test_sse2_cmp_sd(<2 x double> %a, <2 x double> %b) sanitize_memory {
42entry:
43  %0 = tail call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %a, <2 x double> %b, i8 4)
44  ret <2 x double> %0
45}
46
47; CHECK-LABEL: @test_sse2_cmp_sd
48; CHECK: %[[A:.*]] = or <2 x i64>
49; CHECK: %[[B:.*]] = extractelement <2 x i64> %[[A]], i64 0
50; CHECK: %[[C:.*]] = icmp ne i64 %[[B]], 0
51; CHECK: %[[D:.*]] = sext i1 %[[C]] to i128
52; CHECK: %[[E:.*]] = bitcast i128 %[[D]] to <2 x i64>
53; CHECK: store <2 x i64> %[[E]]
54
55
56define i32 @test_sse_comineq_ss(<4 x float> %a, <4 x float> %b) sanitize_memory {
57entry:
58  %0 = tail call i32 @llvm.x86.sse.comineq.ss(<4 x float> %a, <4 x float> %b)
59  ret i32 %0
60}
61
62; CHECK-LABEL: @test_sse_comineq_ss
63; CHECK: %[[A:.*]] = or <4 x i32>
64; CHECK: %[[B:.*]] = extractelement <4 x i32> %[[A]], i64 0
65; CHECK: %[[C:.*]] = icmp ne i32 %[[B]], 0
66; CHECK: %[[D:.*]] = sext i1 %[[C]] to i32
67; CHECK: store i32 %[[D]]
68
69
70define i32 @test_sse2_ucomilt_sd(<2 x double> %a, <2 x double> %b) sanitize_memory {
71entry:
72  %0 = tail call i32 @llvm.x86.sse2.ucomilt.sd(<2 x double> %a, <2 x double> %b)
73  ret i32 %0
74}
75
76; CHECK-LABEL: @test_sse2_ucomilt_sd
77; CHECK: %[[A:.*]] = or <2 x i64>
78; CHECK: %[[B:.*]] = extractelement <2 x i64> %[[A]], i64 0
79; CHECK: %[[C:.*]] = icmp ne i64 %[[B]], 0
80; CHECK: %[[D:.*]] = sext i1 %[[C]] to i32
81; CHECK: store i32 %[[D]]
82