1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX6 %s
3 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX9 %s
4 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX9 %s
5 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX9 %s
8 name: smax_neg_abs_pattern_s32_ss
11 tracksRegLiveness: true
17 ; GFX6-LABEL: name: smax_neg_abs_pattern_s32_ss
18 ; GFX6: liveins: $sgpr0
20 ; GFX6-NEXT: %src0:sreg_32 = COPY $sgpr0
21 ; GFX6-NEXT: %smax:sreg_32 = S_ABS_I32 %src0, implicit-def dead $scc
22 ; GFX6-NEXT: S_ENDPGM 0, implicit %smax
24 ; GFX9-LABEL: name: smax_neg_abs_pattern_s32_ss
25 ; GFX9: liveins: $sgpr0
27 ; GFX9-NEXT: %src0:sreg_32 = COPY $sgpr0
28 ; GFX9-NEXT: %smax:sreg_32 = S_ABS_I32 %src0, implicit-def dead $scc
29 ; GFX9-NEXT: S_ENDPGM 0, implicit %smax
30 %src0:sgpr(s32) = COPY $sgpr0
31 %zero:sgpr(s32) = G_CONSTANT i32 0
32 %ineg:sgpr(s32) = G_SUB %zero, %src0
33 %smax:sgpr(s32) = G_SMAX %src0, %ineg
34 S_ENDPGM 0, implicit %smax
38 name: smax_neg_abs_pattern_s32_ss_commute
41 tracksRegLiveness: true
47 ; GFX6-LABEL: name: smax_neg_abs_pattern_s32_ss_commute
48 ; GFX6: liveins: $sgpr0
50 ; GFX6-NEXT: %src0:sreg_32 = COPY $sgpr0
51 ; GFX6-NEXT: %smax:sreg_32 = S_ABS_I32 %src0, implicit-def dead $scc
52 ; GFX6-NEXT: S_ENDPGM 0, implicit %smax
54 ; GFX9-LABEL: name: smax_neg_abs_pattern_s32_ss_commute
55 ; GFX9: liveins: $sgpr0
57 ; GFX9-NEXT: %src0:sreg_32 = COPY $sgpr0
58 ; GFX9-NEXT: %smax:sreg_32 = S_ABS_I32 %src0, implicit-def dead $scc
59 ; GFX9-NEXT: S_ENDPGM 0, implicit %smax
60 %src0:sgpr(s32) = COPY $sgpr0
61 %zero:sgpr(s32) = G_CONSTANT i32 0
62 %ineg:sgpr(s32) = G_SUB %zero, %src0
63 %smax:sgpr(s32) = G_SMAX %ineg, %src0
64 S_ENDPGM 0, implicit %smax
68 name: smax_neg_abs_pattern_s32_vv
71 tracksRegLiveness: true
77 ; GFX6-LABEL: name: smax_neg_abs_pattern_s32_vv
78 ; GFX6: liveins: $vgpr0
80 ; GFX6-NEXT: %src0:vgpr_32 = COPY $vgpr0
81 ; GFX6-NEXT: %zero:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
82 ; GFX6-NEXT: %ineg:vgpr_32, dead %4:sreg_64 = V_SUB_CO_U32_e64 %zero, %src0, 0, implicit $exec
83 ; GFX6-NEXT: %smax:vgpr_32 = V_MAX_I32_e64 %src0, %ineg, implicit $exec
84 ; GFX6-NEXT: S_ENDPGM 0, implicit %smax
86 ; GFX9-LABEL: name: smax_neg_abs_pattern_s32_vv
87 ; GFX9: liveins: $vgpr0
89 ; GFX9-NEXT: %src0:vgpr_32 = COPY $vgpr0
90 ; GFX9-NEXT: %zero:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
91 ; GFX9-NEXT: %ineg:vgpr_32 = V_SUB_U32_e64 %zero, %src0, 0, implicit $exec
92 ; GFX9-NEXT: %smax:vgpr_32 = V_MAX_I32_e64 %src0, %ineg, implicit $exec
93 ; GFX9-NEXT: S_ENDPGM 0, implicit %smax
94 %src0:vgpr(s32) = COPY $vgpr0
95 %zero:vgpr(s32) = G_CONSTANT i32 0
96 %ineg:vgpr(s32) = G_SUB %zero, %src0
97 %smax:vgpr(s32) = G_SMAX %src0, %ineg
98 S_ENDPGM 0, implicit %smax
101 # FIXME: Violates constant bus restriction
103 # name: smax_neg_abs_pattern_s32_vs
105 # regBankSelected: true
111 # %src0:sgpr(s32) = COPY $sgpr0
112 # %zero:sgpr(s32) = G_CONSTANT i32 0
113 # %ineg:sgpr(s32) = G_SUB %zero, %src0
114 # %smax:vgpr(s32) = G_SMAX %src0, %ineg
115 # S_ENDPGM 0, implicit %smax