From: Matt Arsenault Date: Sat, 29 Jun 2019 00:55:16 +0000 (+0000) Subject: AMDGPU/GlobalISel: Add some more tests for icmp select X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ab3aebea9e4cc44fad4575233c4bacd3d6e25d7;p=llvm AMDGPU/GlobalISel: Add some more tests for icmp select git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364703 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-icmp.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-icmp.mir index 1e3b9c22f5f..299bd00e748 100644 --- a/test/CodeGen/AMDGPU/GlobalISel/inst-select-icmp.mir +++ b/test/CodeGen/AMDGPU/GlobalISel/inst-select-icmp.mir @@ -1,11 +1,12 @@ +# RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s -check-prefixes=GCN # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s -check-prefixes=GCN --- -name: icmp_s_mix +name: icmp_s32_s_mix legalized: true regBankSelected: true -# GCN: name: icmp_s_mix +# GCN: name: icmp_s32_s_mix # GCN: [[SGPR0:%[0-9]+]]:sreg_32 = COPY $sgpr0 # GCN: [[SGPR1:%[0-9]+]]:sreg_32 = COPY $sgpr1 # GCN: [[SGPR2:%[0-9]+]]:sreg_32 = COPY $sgpr2 @@ -47,11 +48,11 @@ body: | ... --- -name: icmp_salu +name: icmp_s32_salu legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_salu +# GCN-LABEL: name: icmp_s32_salu # GCN: S_CMP_LG_U32 # GCN: S_CMP_EQ_U32 # GCN: S_CMP_GT_I32 @@ -115,11 +116,11 @@ body: | ... --- -name: icmp_v_mix +name: icmp_s32_v_mix legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_v_mix +# GCN-LABEL: name: icmp_s32_v_mix # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 # GCN: [[VGPR3:%[0-9]+]]:vgpr_32 = COPY $vgpr3 # GCN: [[VGPR4:%[0-9]+]]:vgpr_32 = COPY $vgpr4 @@ -146,19 +147,19 @@ body: | %6:vgpr(s32) = COPY $vgpr7 %7:vgpr(s32) = COPY $vgpr8 %8:vgpr(s32) = COPY $vgpr9 - %9:sgpr(s1) = G_ICMP intpred(ne), %1, %2 - %10:sgpr(s1) = G_ICMP intpred(ne), %5, %6 + %9:vcc(s1) = G_ICMP intpred(ne), %1, %2 + %10:vcc(s1) = G_ICMP intpred(ne), %5, %6 %11:vgpr(s32) = G_SELECT %9, %7, %8 %12:vgpr(s32) = G_SELECT %10, %3, %4 G_STORE %11, %0 :: (volatile store 4, addrspace 1) G_STORE %12, %0 :: (volatile store 4, addrspace 1) ... --- -name: icmp_valu +name: icmp_s32_valu legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_valu +# GCN-LABEL: name: icmp_s32_valu # GCN: V_CMP_NE_U32_e64 # GCN: V_CMP_EQ_U32_e64 # GCN: V_CMP_GT_I32_e64 @@ -179,16 +180,16 @@ body: | %2:vgpr(s32) = COPY $vgpr3 %3:vgpr(s32) = COPY $vgpr4 %4:vgpr(s32) = COPY $vgpr5 - %5:sgpr(s1) = G_ICMP intpred(ne), %1, %2 - %6:sgpr(s1) = G_ICMP intpred(eq), %1, %2 - %7:sgpr(s1) = G_ICMP intpred(sgt), %1, %2 - %8:sgpr(s1) = G_ICMP intpred(sge), %1, %2 - %9:sgpr(s1) = G_ICMP intpred(slt), %1, %2 - %10:sgpr(s1) = G_ICMP intpred(sle), %1, %2 - %11:sgpr(s1) = G_ICMP intpred(ugt), %1, %2 - %12:sgpr(s1) = G_ICMP intpred(uge), %1, %2 - %13:sgpr(s1) = G_ICMP intpred(ult), %1, %2 - %14:sgpr(s1) = G_ICMP intpred(ule), %1, %2 + %5:vcc(s1) = G_ICMP intpred(ne), %1, %2 + %6:vcc(s1) = G_ICMP intpred(eq), %1, %2 + %7:vcc(s1) = G_ICMP intpred(sgt), %1, %2 + %8:vcc(s1) = G_ICMP intpred(sge), %1, %2 + %9:vcc(s1) = G_ICMP intpred(slt), %1, %2 + %10:vcc(s1) = G_ICMP intpred(sle), %1, %2 + %11:vcc(s1) = G_ICMP intpred(ugt), %1, %2 + %12:vcc(s1) = G_ICMP intpred(uge), %1, %2 + %13:vcc(s1) = G_ICMP intpred(ult), %1, %2 + %14:vcc(s1) = G_ICMP intpred(ule), %1, %2 %15:vgpr(s32) = G_SELECT %5, %3, %4 %16:vgpr(s32) = G_SELECT %6, %3, %4 %17:vgpr(s32) = G_SELECT %7, %3, %4 @@ -212,11 +213,11 @@ body: | ... --- -name: icmp_vv +name: icmp_s32_vv legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_vv +# GCN-LABEL: name: icmp_s32_vv # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 # GCN: [[VGPR3:%[0-9]+]]:vgpr_32 = COPY $vgpr3 # GCN: V_CMP_NE_U32_e64 [[VGPR2]], [[VGPR3]] @@ -230,17 +231,17 @@ body: | %2:vgpr(s32) = COPY $vgpr3 %3:vgpr(s32) = COPY $vgpr4 %4:vgpr(s32) = COPY $vgpr5 - %5:sgpr(s1) = G_ICMP intpred(ne), %1, %2 + %5:vcc(s1) = G_ICMP intpred(ne), %1, %2 %6:vgpr(s32) = G_SELECT %5, %3, %4 G_STORE %6, %0 :: (store 4, addrspace 1) ... --- -name: icmp_vs +name: icmp_s32_vs legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_vs +# GCN-LABEL: name: icmp_s32_vs # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 # GCN: [[SGPR0:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 # GCN: V_CMP_NE_U32_e64 [[VGPR2]], [[SGPR0]] @@ -254,17 +255,17 @@ body: | %2:vgpr(s32) = COPY $vgpr3 %3:vgpr(s32) = COPY $vgpr4 %4:sgpr(s32) = COPY $sgpr0 - %5:sgpr(s1) = G_ICMP intpred(ne), %1, %4 + %5:vcc(s1) = G_ICMP intpred(ne), %1, %4 %6:vgpr(s32) = G_SELECT %5, %2, %3 G_STORE %6, %0 :: (store 4, addrspace 1) ... --- -name: icmp_sv +name: icmp_s32_sv legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_sv +# GCN-LABEL: name: icmp_s32_sv # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 # GCN: [[SGPR0:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 # GCN: V_CMP_NE_U32_e64 [[SGPR0]], [[VGPR2]] @@ -278,17 +279,17 @@ body: | %2:vgpr(s32) = COPY $vgpr3 %3:vgpr(s32) = COPY $vgpr4 %4:sgpr(s32) = COPY $sgpr0 - %5:sgpr(s1) = G_ICMP intpred(ne), %4, %1 + %5:vcc(s1) = G_ICMP intpred(ne), %4, %1 %6:vgpr(s32) = G_SELECT %5, %2, %3 G_STORE %6, %0 :: (store 4, addrspace 1) ... --- -name: icmp_or_vcc +name: icmp_s32_or_vcc legalized: true regBankSelected: true -# GCN-LABEL: name: icmp_or_vcc +# GCN-LABEL: name: icmp_s32_or_vcc # GCN: [[VGPR2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 # GCN: [[SGPR0:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 # GCN: V_CMP_NE_U32_e64 [[SGPR0]], [[VGPR2]] @@ -302,8 +303,55 @@ body: | %2:vgpr(s32) = COPY $vgpr3 %3:vgpr(s32) = COPY $vgpr4 %4:sgpr(s32) = COPY $sgpr0 - %5:sgpr(s1) = G_ICMP intpred(ne), %4, %1 + %5:vcc(s1) = G_ICMP intpred(ne), %4, %1 %6:vgpr(s32) = G_SELECT %5, %2, %3 G_STORE %6, %0 :: (store 4, addrspace 1) ... + --- + +name: icmp_eq_ne_p3_ss +legalized: true +regBankSelected: true + +# GCN-LABEL: name: icmp_eq_ne_p3_ss +# GCN: S_CMP_EQ_U32 %0, %1, implicit-def $scc +# GCN: S_CMP_LG_U32 %0, %1, implicit-def $scc + +body: | + bb.0: + liveins: $sgpr0, $sgpr1 + + %0:sgpr(p3) = COPY $sgpr0 + %1:sgpr(p3) = COPY $sgpr1 + %2:scc(s1) = G_ICMP intpred(eq), %0, %1 + %3:scc(s1) = G_ICMP intpred(ne), %0, %1 + %4:sgpr(s32) = G_SEXT %2 + %5:sgpr(s32) = G_SEXT %3 + S_ENDPGM 0, implicit %4, implicit %5 + +... + +--- + +name: icmp_eq_ne_p3_vv +legalized: true +regBankSelected: true + +# GCN-LABEL: name: icmp_eq_ne_p3_vv +# GCN: %2:sreg_64_xexec = V_CMP_EQ_U32_e64 %0, %1, implicit $exec +# GCN: %3:sreg_64_xexec = V_CMP_NE_U32_e64 %0, %1, implicit $exec + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + + %0:vgpr(p3) = COPY $vgpr0 + %1:vgpr(p3) = COPY $vgpr1 + %2:vcc(s1) = G_ICMP intpred(eq), %0, %1 + %3:vcc(s1) = G_ICMP intpred(ne), %0, %1 + %4:vgpr(s32) = G_SEXT %2 + %5:vgpr(s32) = G_SEXT %3 + S_ENDPGM 0, implicit %4, implicit %5 + +...