llvm.org GIT mirror llvm / fe32163
[msan] Add a test for vector compare x86 intrinsics. This was actually meant to go in with r267966, but I forgot to git add the file. Better late than never. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270515 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 4 years ago
1 changed file(s) with 81 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
1
2 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"
3 target triple = "x86_64-unknown-linux-gnu"
4
5 declare <4 x float> @llvm.x86.sse.cmp.ss(<4 x float>, <4 x float>, i8) nounwind readnone
6 declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone
7 declare <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double>, <2 x double>, i8) nounwind readnone
8 declare i32 @llvm.x86.sse.comineq.ss(<4 x float>, <4 x float>) nounwind readnone
9 declare i32 @llvm.x86.sse2.ucomilt.sd(<2 x double>, <2 x double>) nounwind readnone
10
11
12 define <4 x float> @test_sse_cmp_ss(<4 x float> %a, <4 x float> %b) sanitize_memory {
13 entry:
14 %0 = tail call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %a, <4 x float> %b, i8 4)
15 ret <4 x float> %0
16 }
17
18 ; CHECK-LABEL: @test_sse_cmp_ss
19 ; CHECK: %[[A:.*]] = or <4 x i32>
20 ; CHECK: %[[B:.*]] = extractelement <4 x i32> %[[A]], i64 0
21 ; CHECK: %[[C:.*]] = icmp ne i32 %[[B]], 0
22 ; CHECK: %[[D:.*]] = sext i1 %[[C]] to i128
23 ; CHECK: %[[E:.*]] = bitcast i128 %[[D]] to <4 x i32>
24 ; CHECK: store <4 x i32> %[[E]]
25
26
27 define <4 x float> @test_sse_cmp_ps(<4 x float> %a, <4 x float> %b) sanitize_memory {
28 entry:
29 %0 = tail call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %a, <4 x float> %b, i8 4)
30 ret <4 x float> %0
31 }
32
33 ; CHECK-LABEL: @test_sse_cmp_ps
34 ; CHECK: %[[A:.*]] = or <4 x i32>
35 ; CHECK: %[[B:.*]] = icmp ne <4 x i32> %[[A]], zeroinitializer
36 ; CHECK: %[[C:.*]] = sext <4 x i1> %[[B]] to <4 x i32>
37 ; CHECK: store <4 x i32> %[[C]]
38
39
40 define <2 x double> @test_sse2_cmp_sd(<2 x double> %a, <2 x double> %b) sanitize_memory {
41 entry:
42 %0 = tail call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %a, <2 x double> %b, i8 4)
43 ret <2 x double> %0
44 }
45
46 ; CHECK-LABEL: @test_sse2_cmp_sd
47 ; CHECK: %[[A:.*]] = or <2 x i64>
48 ; CHECK: %[[B:.*]] = extractelement <2 x i64> %[[A]], i64 0
49 ; CHECK: %[[C:.*]] = icmp ne i64 %[[B]], 0
50 ; CHECK: %[[D:.*]] = sext i1 %[[C]] to i128
51 ; CHECK: %[[E:.*]] = bitcast i128 %[[D]] to <2 x i64>
52 ; CHECK: store <2 x i64> %[[E]]
53
54
55 define i32 @test_sse_comineq_ss(<4 x float> %a, <4 x float> %b) sanitize_memory {
56 entry:
57 %0 = tail call i32 @llvm.x86.sse.comineq.ss(<4 x float> %a, <4 x float> %b)
58 ret i32 %0
59 }
60
61 ; CHECK-LABEL: @test_sse_comineq_ss
62 ; CHECK: %[[A:.*]] = or <4 x i32>
63 ; CHECK: %[[B:.*]] = extractelement <4 x i32> %[[A]], i64 0
64 ; CHECK: %[[C:.*]] = icmp ne i32 %[[B]], 0
65 ; CHECK: %[[D:.*]] = sext i1 %[[C]] to i32
66 ; CHECK: store i32 %[[D]]
67
68
69 define i32 @test_sse2_ucomilt_sd(<2 x double> %a, <2 x double> %b) sanitize_memory {
70 entry:
71 %0 = tail call i32 @llvm.x86.sse2.ucomilt.sd(<2 x double> %a, <2 x double> %b)
72 ret i32 %0
73 }
74
75 ; CHECK-LABEL: @test_sse2_ucomilt_sd
76 ; CHECK: %[[A:.*]] = or <2 x i64>
77 ; CHECK: %[[B:.*]] = extractelement <2 x i64> %[[A]], i64 0
78 ; CHECK: %[[C:.*]] = icmp ne i64 %[[B]], 0
79 ; CHECK: %[[D:.*]] = sext i1 %[[C]] to i32
80 ; CHECK: store i32 %[[D]]