Skip to content

Commit a1c7c6f

Browse files
committed
Use same subtarget. Test sub.
Signed-off-by: John Lu <[email protected]>
1 parent 463769e commit a1c7c6f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

llvm/test/CodeGen/AMDGPU/s_uaddo_pseudo.ll

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; 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
2+
; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -stop-after=amdgpu-isel < %s | FileCheck -check-prefixes=GCN-ISEL %s
33
; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck %s
44
; Ensure that S_UADDO_PSEUDO is selected when carryout user is S_ADD_CO_PSEUDO
55

@@ -22,5 +22,25 @@ define amdgpu_ps i32 @s_uaddo_pseudo(i32 inreg %val0) {
2222
%result = add i32 %zext_carryout, 1
2323
ret i32 %result
2424
}
25+
26+
; GCN-ISEL-LABEL: name: s_usubo_pseudo
27+
; GCN-ISEL-LABEL: body:
28+
; GCN-ISEL: S_USUBO_PSEUDO
29+
; GCN-ISEL: S_SUB_CO_PSEUDO
30+
31+
define amdgpu_ps i32 @s_usubo_pseudo(i32 inreg %val0, i32 inreg %val1) {
32+
; CHECK-LABEL: s_usubo_pseudo:
33+
; CHECK: ; %bb.0:
34+
; CHECK-NEXT: s_sub_u32 s0, s0, 1
35+
; CHECK-NEXT: s_cselect_b64 s[2:3], -1, 0
36+
; CHECK-NEXT: s_cmp_lg_u64 s[2:3], 0
37+
; CHECK-NEXT: s_subb_u32 s0, s1, 0
38+
; CHECK-NEXT: ; return to shader part epilog
39+
%pair = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %val0, i32 1)
40+
%carryout = extractvalue { i32, i1 } %pair, 1
41+
%zext_carryout = zext i1 %carryout to i32
42+
%result = sub i32 %val1, %zext_carryout
43+
ret i32 %result
44+
}
2545
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
2646
; GCN-ISEL: {{.*}}

0 commit comments

Comments
 (0)