|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 |
| 2 | +; RUN: llc -global-isel -new-reg-bank-select -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 < %s | FileCheck %s |
| 3 | + |
| 4 | +define amdgpu_ps i32 @uniform_fshr_i32(i32 %lhs, i32 %rhs, i32 %amt) { |
| 5 | +; CHECK-LABEL: uniform_fshr_i32: |
| 6 | +; CHECK: ; %bb.0: |
| 7 | +; CHECK-NEXT: v_readfirstlane_b32 s0, v2 |
| 8 | +; CHECK-NEXT: v_readfirstlane_b32 s1, v0 |
| 9 | +; CHECK-NEXT: v_readfirstlane_b32 s2, v1 |
| 10 | +; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1) |
| 11 | +; CHECK-NEXT: v_mov_b32_e32 v0, s0 |
| 12 | +; CHECK-NEXT: v_alignbit_b32 v0, s1, s2, v0 |
| 13 | +; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_1) |
| 14 | +; CHECK-NEXT: v_readfirstlane_b32 s0, v0 |
| 15 | +; CHECK-NEXT: s_wait_alu 0xf1ff |
| 16 | +; CHECK-NEXT: ; return to shader part epilog |
| 17 | + %ulhs = call i32 @llvm.amdgcn.readfirstlane.i32(i32 %lhs) |
| 18 | + %urhs = call i32 @llvm.amdgcn.readfirstlane.i32(i32 %rhs) |
| 19 | + %uamt = call i32 @llvm.amdgcn.readfirstlane.i32(i32 %amt) |
| 20 | + %vres = call i32 @llvm.fshr.i32(i32 %ulhs, i32 %urhs, i32 %uamt) |
| 21 | + ret i32 %vres |
| 22 | +} |
| 23 | + |
| 24 | +declare i32 @llvm.amdgcn.readfirstlane.i32(i32) |
| 25 | + |
| 26 | +define amdgpu_ps i32 @divergent_fshr_i32(i32 %lhs, i32 %rhs, i32 %amt) { |
| 27 | +; CHECK-LABEL: divergent_fshr_i32: |
| 28 | +; CHECK: ; %bb.0: |
| 29 | +; CHECK-NEXT: v_alignbit_b32 v0, v0, v1, v2 |
| 30 | +; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_1) |
| 31 | +; CHECK-NEXT: v_readfirstlane_b32 s0, v0 |
| 32 | +; CHECK-NEXT: ; return to shader part epilog |
| 33 | + %result = call i32 @llvm.fshr.i32(i32 %lhs, i32 %rhs, i32 %amt) |
| 34 | + ret i32 %result |
| 35 | +} |
| 36 | + |
| 37 | +declare i32 @llvm.fshr.i32(i32, i32, i32) |
0 commit comments