• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck  \
2; RUN: %s
3; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
4; REQUIRES: x86-registered-target
5
6target 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"
7target triple = "x86_64-unknown-linux-gnu"
8
9declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone
10declare <2 x double> @llvm.x86.sse2.cvtsi2sd(<2 x double>, i32) nounwind readnone
11declare x86_mmx @llvm.x86.sse.cvtps2pi(<4 x float>) nounwind readnone
12declare i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float>, i32) nounwind readnone
13
14; Single argument vector conversion.
15
16define i32 @test_cvtsd2si(<2 x double> %value) sanitize_memory {
17entry:
18  %0 = tail call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %value)
19  ret i32 %0
20}
21
22; CHECK-LABEL: @test_cvtsd2si
23; CHECK: [[S:%[_01-9a-z]+]] = extractelement <2 x i64> {{.*}}, i32 0
24; CHECK: icmp ne {{.*}}[[S]], 0
25; CHECK: br
26; CHECK: call void @__msan_warning_with_origin_noreturn
27; CHECK: call i32 @llvm.x86.sse2.cvtsd2si
28; CHECK: store i32 0, {{.*}} @__msan_retval_tls
29; CHECK: ret i32
30
31; x86_mmx packed vector conversion.
32
33define x86_mmx @test_cvtps2pi(<4 x float> %value) sanitize_memory {
34entry:
35  %0 = tail call x86_mmx @llvm.x86.sse.cvtps2pi(<4 x float> %value)
36  ret x86_mmx %0
37}
38
39; CHECK-LABEL: @test_cvtps2pi
40; CHECK: extractelement <4 x i32> {{.*}}, i32 0
41; CHECK: extractelement <4 x i32> {{.*}}, i32 1
42; CHECK: [[S:%[_01-9a-z]+]] = or i32
43; CHECK: icmp ne {{.*}}[[S]], 0
44; CHECK: br
45; CHECK: call void @__msan_warning_with_origin_noreturn
46; CHECK: call x86_mmx @llvm.x86.sse.cvtps2pi
47; CHECK: store i64 0, {{.*}} @__msan_retval_tls
48; CHECK: ret x86_mmx
49
50; avx512 rounding conversion.
51
52define i32 @pr48298(<4 x float> %value) sanitize_memory {
53entry:
54  %0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> %value, i32 11)
55  ret i32 %0
56}
57
58; CHECK-LABEL: @pr48298
59; CHECK: extractelement <4 x i32> {{.*}}, i32 0
60; CHECK: icmp ne i32 {{.*}}, 0
61; CHECK: br
62; CHECK: call void @__msan_warning_with_origin_noreturn
63; CHECK: call i32 @llvm.x86.avx512.vcvtss2usi32
64; CHECK: store i32 0, {{.*}} @__msan_retval_tls
65; CHECK: ret i32
66