|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 |
| 2 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -stop-after=amdgpu-isel < %s | FileCheck -check-prefixes=GCN-ISEL %s |
| 3 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck %s |
| 4 | +; Ensure that S_UADDO_PSEUDO is selected when carryout user is S_ADD_CO_PSEUDO |
| 5 | + |
| 6 | +; GCN-ISEL-LABEL: name: s_uaddo_pseudo |
| 7 | +; GCN-ISEL-LABEL: body: |
| 8 | +; GCN-ISEL: S_UADDO_PSEUDO |
| 9 | +; GCN-ISEL: S_ADD_CO_PSEUDO |
| 10 | + |
| 11 | +define amdgpu_ps i32 @s_uaddo_pseudo(i32 inreg %val0, i32 inreg %val1) { |
| 12 | +; CHECK-LABEL: s_uaddo_pseudo: |
| 13 | +; CHECK: ; %bb.0: |
| 14 | +; CHECK-NEXT: s_add_i32 s0, s0, s1 |
| 15 | +; CHECK-NEXT: s_cselect_b64 s[0:1], 1, 0 |
| 16 | +; CHECK-NEXT: s_cmp_lg_u64 s[0:1], 0 |
| 17 | +; CHECK-NEXT: s_addc_u32 s0, 1, 0 |
| 18 | +; CHECK-NEXT: ; return to shader part epilog |
| 19 | + %pair = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %val0, i32 %val1) |
| 20 | + %carryout = extractvalue {i32, i1} %pair, 1 |
| 21 | + %add_overflow = sext i1 %carryout to i32 |
| 22 | + %cmp_carryout = icmp ult i32 0, %add_overflow |
| 23 | + %zext_carryout = zext i1 %cmp_carryout to i32 |
| 24 | + %result = add i32 %zext_carryout, 1 |
| 25 | + ret i32 %result |
| 26 | +} |
| 27 | +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: |
| 28 | +; GCN-ISEL: {{.*}} |
0 commit comments