experimental-reduce.ll
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S -passes='module(msan-module),function(msan)' 2>&1 | \
; RUN: FileCheck -allow-deprecated-dag-overlap -check-prefixes=CHECK,CHECK-ORIGINS %s
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"
target triple = "x86_64-unknown-linux-gnu"
declare i32 @llvm.experimental.vector.reduce.add(<3 x i32>)
declare i32 @llvm.experimental.vector.reduce.and(<3 x i32>)
declare i32 @llvm.experimental.vector.reduce.or(<3 x i32>)
; CHECK-LABEL: @reduce_add
define i32 @reduce_add() sanitize_memory {
; CHECK: [[P:%.*]] = inttoptr i64 0 to <3 x i32>*
%p = inttoptr i64 0 to <3 x i32> *
; CHECK: [[O:%.*]] = load <3 x i32>, <3 x i32>* [[P]]
%o = load <3 x i32>, <3 x i32> *%p
; CHECK: [[O_SHADOW:%.*]] = load <3 x i32>, <3 x i32>*
; CHECK: [[O_ORIGIN:%.*]] = load i32, i32*
; CHECK: [[R_SHADOW:%.*]] = call i32 @llvm.experimental.vector.reduce.or.v3i32(<3 x i32> [[O_SHADOW]])
; CHECK: [[R:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v3i32(<3 x i32> [[O]])
%r = call i32 @llvm.experimental.vector.reduce.add(<3 x i32> %o)
; CHECK: store i32 [[R_SHADOW]], {{.*}} @__msan_retval_tls
; CHECK: store i32 [[O_ORIGIN]], {{.*}} @__msan_retval_origin_tls
; CHECK: ret i32 [[R]]
ret i32 %r
}
; CHECK-LABEL: @reduce_and
define i32 @reduce_and() sanitize_memory {
; CHECK: [[P:%.*]] = inttoptr i64 0 to <3 x i32>*
%p = inttoptr i64 0 to <3 x i32> *
; CHECK: [[O:%.*]] = load <3 x i32>, <3 x i32>* [[P]]
%o = load <3 x i32>, <3 x i32> *%p
; CHECK: [[O_SHADOW:%.*]] = load <3 x i32>, <3 x i32>*
; CHECK: [[O_ORIGIN:%.*]] = load i32, i32*
; CHECK: [[O_SHADOW_1:%.*]] = or <3 x i32> [[O]], [[O_SHADOW]]
; CHECK: [[O_SHADOW_2:%.*]] = call i32 @llvm.experimental.vector.reduce.and.v3i32(<3 x i32> [[O_SHADOW_1]]
; CHECK: [[O_SHADOW_3:%.*]] = call i32 @llvm.experimental.vector.reduce.or.v3i32(<3 x i32> [[O_SHADOW]])
; CHECK: [[R_SHADOW:%.*]] = and i32 [[O_SHADOW_2]], [[O_SHADOW_3]]
; CHECK: [[R:%.*]] = call i32 @llvm.experimental.vector.reduce.and.v3i32(<3 x i32> [[O]])
%r = call i32 @llvm.experimental.vector.reduce.and(<3 x i32> %o)
; CHECK: store i32 [[R_SHADOW]], {{.*}} @__msan_retval_tls
; CHECK: store i32 [[O_ORIGIN]], {{.*}} @__msan_retval_origin_tls
; CHECK: ret i32 [[R]]
ret i32 %r
}
; CHECK-LABEL: @reduce_or
define i32 @reduce_or() sanitize_memory {
; CHECK: [[P:%.*]] = inttoptr i64 0 to <3 x i32>*
%p = inttoptr i64 0 to <3 x i32> *
; CHECK: [[O:%.*]] = load <3 x i32>, <3 x i32>* [[P]]
%o = load <3 x i32>, <3 x i32> *%p
; CHECK: [[O_SHADOW:%.*]] = load <3 x i32>, <3 x i32>*
; CHECK: [[O_ORIGIN:%.*]] = load i32, i32*
; CHECK: [[NOT_O:%.*]] = xor <3 x i32> [[O]], <i32 -1, i32 -1, i32 -1>
; CHECK: [[O_SHADOW_1:%.*]] = or <3 x i32> [[NOT_O]], [[O_SHADOW]]
; CHECK: [[O_SHADOW_2:%.*]] = call i32 @llvm.experimental.vector.reduce.and.v3i32(<3 x i32> [[O_SHADOW_1]]
; CHECK: [[O_SHADOW_3:%.*]] = call i32 @llvm.experimental.vector.reduce.or.v3i32(<3 x i32> [[O_SHADOW]])
; CHECK: [[R_SHADOW:%.*]] = and i32 [[O_SHADOW_2]], [[O_SHADOW_3]]
; CHECK: [[R:%.*]] = call i32 @llvm.experimental.vector.reduce.or.v3i32(<3 x i32> [[O]])
%r = call i32 @llvm.experimental.vector.reduce.or(<3 x i32> %o)
; CHECK: store i32 [[R_SHADOW]], {{.*}} @__msan_retval_tls
; CHECK: store i32 [[O_ORIGIN]], {{.*}} @__msan_retval_origin_tls
; CHECK: ret i32 [[R]]
ret i32 %r
}