| 1 |
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 2 |
// RUN: dxil-pc-shadermodel6.3-library %s \ |
| 3 |
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s |
| 4 |
|
| 5 |
int shl32(int V, int S) { |
| 6 |
return V << S; |
| 7 |
} |
| 8 |
|
| 9 |
// CHECK: define noundef i32 @"?shl32{{[@$?.A-Za-z0-9_]+}}"(i32 noundef %V, i32 noundef %S) #0 { |
| 10 |
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31 |
| 11 |
// CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]] |
| 12 |
|
| 13 |
int shr32(int V, int S) { |
| 14 |
return V >> S; |
| 15 |
} |
| 16 |
|
| 17 |
// CHECK: define noundef i32 @"?shr32{{[@$?.A-Za-z0-9_]+}}"(i32 noundef %V, i32 noundef %S) #0 { |
| 18 |
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31 |
| 19 |
// CHECK-DAG: %{{.*}} = ashr i32 %{{.*}}, %[[Masked]] |
| 20 |
|
| 21 |
int64_t shl64(int64_t V, int64_t S) { |
| 22 |
return V << S; |
| 23 |
} |
| 24 |
|
| 25 |
// CHECK: define noundef i64 @"?shl64{{[@$?.A-Za-z0-9_]+}}"(i64 noundef %V, i64 noundef %S) #0 { |
| 26 |
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63 |
| 27 |
// CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]] |
| 28 |
|
| 29 |
int64_t shr64(int64_t V, int64_t S) { |
| 30 |
return V >> S; |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK: define noundef i64 @"?shr64{{[@$?.A-Za-z0-9_]+}}"(i64 noundef %V, i64 noundef %S) #0 { |
| 34 |
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63 |
| 35 |
// CHECK-DAG: %{{.*}} = ashr i64 %{{.*}}, %[[Masked]] |