Debian Codegraph @

clang/test/CodeGenHLSL/shift-mask.hlsl

raw
1 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \
2 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
3
4 int shl32(int V, int S) {
5 return V << S;
6 }
7
8 // CHECK-LABEL: define hidden noundef i32 @_Z5shl32ii(i32 noundef %V, i32 noundef %S) #0 {
9 // CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
10 // CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]]
11
12 int shr32(int V, int S) {
13 return V >> S;
14 }
15
16 // CHECK-LABEL: define hidden noundef i32 @_Z5shr32ii(i32 noundef %V, i32 noundef %S) #0 {
17 // CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
18 // CHECK-DAG: %{{.*}} = ashr i32 %{{.*}}, %[[Masked]]
19
20 int64_t shl64(int64_t V, int64_t S) {
21 return V << S;
22 }
23
24 // CHECK-LABEL: define hidden noundef i64 @_Z5shl64ll(i64 noundef %V, i64 noundef %S) #0 {
25 // CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
26 // CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]]
27
28 int64_t shr64(int64_t V, int64_t S) {
29 return V >> S;
30 }
31
32 // CHECK-LABEL: define hidden noundef i64 @_Z5shr64ll(i64 noundef %V, i64 noundef %S) #0 {
33 // CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
34 // CHECK-DAG: %{{.*}} = ashr i64 %{{.*}}, %[[Masked]]
35
36 uint shlu32(uint V, uint S) {
37 return V << S;
38 }
39
40 // CHECK-LABEL: define hidden noundef i32 @_Z6shlu32jj(i32 noundef %V, i32 noundef %S) #0 {
41 // CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
42 // CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]]
43
44 uint shru32(uint V, uint S) {
45 return V >> S;
46 }
47
48 // CHECK-LABEL: define hidden noundef i32 @_Z6shru32jj(i32 noundef %V, i32 noundef %S) #0 {
49 // CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
50 // CHECK-DAG: %{{.*}} = lshr i32 %{{.*}}, %[[Masked]]
51
52 uint64_t shlu64(uint64_t V, uint64_t S) {
53 return V << S;
54 }
55
56 // CHECK-LABEL: define hidden noundef i64 @_Z6shlu64mm(i64 noundef %V, i64 noundef %S) #0 {
57 // CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
58 // CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]]
59
60 uint64_t shru64(uint64_t V, uint64_t S) {
61 return V >> S;
62 }
63
64 // CHECK-LABEL: define hidden noundef i64 @_Z6shru64mm(i64 noundef %V, i64 noundef %S) #0 {
65 // CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
66 // CHECK-DAG: %{{.*}} = lshr i64 %{{.*}}, %[[Masked]]