|
| 1 | +; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s |
| 2 | +; |
| 3 | +; Test that we have the correct shader flags to indicate that there are wave |
| 4 | +; ops set at the module level |
| 5 | +; |
| 6 | +; CHECK: ; Shader Flags Value: [[WAVE_FLAG:0x00080000]] |
| 7 | +; CHECK: ; Note: shader requires additional functionality: |
| 8 | +; CHECK-NEXT: ; Wave level operations |
| 9 | +; CHECK-NEXT: ; Note: extra DXIL module flags: |
| 10 | + |
| 11 | +target triple = "dxil-pc-shadermodel6.7-library" |
| 12 | + |
| 13 | +; Test the indiviual ops that they have the same Shader Wave flag at the |
| 14 | +; function level to ensure that each op is setting it accordingly |
| 15 | + |
| 16 | +define noundef i1 @wave_is_first_lane() { |
| 17 | +entry: |
| 18 | + ; CHECK: Function wave_is_first_lane : [[WAVE_FLAG]] |
| 19 | + %ret = call i1 @llvm.dx.wave.is.first.lane() |
| 20 | + ret i1 %ret |
| 21 | +} |
| 22 | + |
| 23 | +define noundef i32 @wave_getlaneindex() { |
| 24 | +entry: |
| 25 | + ; CHECK: Function wave_getlaneindex : [[WAVE_FLAG]] |
| 26 | + %ret = call i32 @llvm.dx.wave.getlaneindex() |
| 27 | + ret i32 %ret |
| 28 | +} |
| 29 | + |
| 30 | +define noundef i1 @wave_any(i1 %x) { |
| 31 | +entry: |
| 32 | + ; CHECK: Function wave_any : [[WAVE_FLAG]] |
| 33 | + %ret = call i1 @llvm.dx.wave.any(i1 %x) |
| 34 | + ret i1 %ret |
| 35 | +} |
| 36 | + |
| 37 | +define noundef i1 @wave_all(i1 %x) { |
| 38 | +entry: |
| 39 | + ; CHECK: Function wave_all : [[WAVE_FLAG]] |
| 40 | + %ret = call i1 @llvm.dx.wave.all(i1 %x) |
| 41 | + ret i1 %ret |
| 42 | +} |
| 43 | + |
| 44 | +define noundef i1 @wave_readlane(i1 %x, i32 %idx) { |
| 45 | +entry: |
| 46 | + ; CHECK: Function wave_readlane : [[WAVE_FLAG]] |
| 47 | + %ret = call i1 @llvm.dx.wave.readlane.i1(i1 %x, i32 %idx) |
| 48 | + ret i1 %ret |
| 49 | +} |
| 50 | + |
| 51 | +define noundef i32 @wave_reduce_sum(i32 noundef %x) { |
| 52 | +entry: |
| 53 | + ; CHECK: Function wave_reduce_sum : [[WAVE_FLAG]] |
| 54 | + %ret = call i32 @llvm.dx.wave.reduce.sum.i32(i32 %x) |
| 55 | + ret i32 %ret |
| 56 | +} |
| 57 | + |
| 58 | +define noundef i32 @wave_reduce_usum(i32 noundef %x) { |
| 59 | +entry: |
| 60 | + ; CHECK: Function wave_reduce_usum : [[WAVE_FLAG]] |
| 61 | + %ret = call i32 @llvm.dx.wave.reduce.usum.i32(i32 %x) |
| 62 | + ret i32 %ret |
| 63 | +} |
| 64 | + |
| 65 | +define noundef i32 @wave_reduce_max(i32 noundef %x) { |
| 66 | +entry: |
| 67 | + ; CHECK: Function wave_reduce_max : [[WAVE_FLAG]] |
| 68 | + %ret = call i32 @llvm.dx.wave.reduce.max.i32(i32 %x) |
| 69 | + ret i32 %ret |
| 70 | +} |
| 71 | + |
| 72 | +define noundef i32 @wave_reduce_umax(i32 noundef %x) { |
| 73 | +entry: |
| 74 | + ; CHECK: Function wave_reduce_umax : [[WAVE_FLAG]] |
| 75 | + %ret = call i32 @llvm.dx.wave.reduce.umax.i32(i32 %x) |
| 76 | + ret i32 %ret |
| 77 | +} |
| 78 | + |
| 79 | +define void @wave_active_countbits(i1 %expr) { |
| 80 | +entry: |
| 81 | + ; CHECK: Function wave_active_countbits : [[WAVE_FLAG]] |
| 82 | + %0 = call i32 @llvm.dx.wave.active.countbits(i1 %expr) |
| 83 | + ret void |
| 84 | +} |
0 commit comments