Skip to content

Commit

Permalink
[DPWBS-1164] test(Legalizer): prepare test with generator
Browse files Browse the repository at this point in the history
Updating the legality rules for legalizer artifacts have a big impact
on many different tests. To update these tests a update script is
usually used. If the tests where hand-written however, this causes very
large non-functional changes as the generator has a different naming
scheme than a human would use.

In order to prepare for this, this commit updates all tests that will be
affected by the legality changes. This way, the commit with the
functional changes only contains the functional changes in the tests as
well.
  • Loading branch information
gargaroff committed Jan 22, 2020
1 parent 5c23ed8 commit 72fd77e
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 142 deletions.
77 changes: 39 additions & 38 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-ashr.mir
@@ -1,3 +1,4 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
---
name: test_ashr_i32
Expand All @@ -6,8 +7,8 @@ body: |
; CHECK-LABEL: name: test_ashr_i32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d5
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[COPY1]]
; CHECK: $d2 = COPY [[AND]](s32)
; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[COPY1]](s32)
; CHECK: $d2 = COPY [[ASHR]](s32)
%0:_(s32) = COPY $d4
%1:_(s32) = COPY $d5
%2:_(s32) = G_ASHR %0, %1
Expand All @@ -20,14 +21,14 @@ body: |
; CHECK-LABEL: name: test_ashr_small_scalar
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d5
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]]
; CHECK: [[AMTMASK:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[AMTMASK]]
; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]]
; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SEXT]], [[AND]]
; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ASHR]](s32)
; CHECK: $d2 = COPY [[COPY4]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s8)
; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SEXT]], [[AND]](s32)
; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ASHR]](s32)
; CHECK: $d2 = COPY [[COPY3]](s32)
%0:_(s32) = COPY $d4
%1:_(s32) = COPY $d5
%2:_(s8) = G_TRUNC %0:_(s32)
Expand All @@ -41,40 +42,40 @@ name: test_ashr_big_scalar
body: |
bb.0.entry:
; There are two cases to consider:
; 1) If the shift amount is >= 32-bit, the higher bits of the source are
; shifted completely into the lower bits of the result (using an
; adjusted shift amount, ADJ_AMT), while the higher bits of the result
; 1) If the shift amount is >= 32-bit, the higher bits of the source are
; shifted completely into the lower bits of the result (using an
; adjusted shift amount, SUB), while the higher bits of the result
; carry the sign bits of the higher bits of the src
; 2) If the shift amount is < 32, both the higher bits and the lower bits of
; the src are shifted by the same amount, however parts of the upper bits
; might be shifted into the lower part. Thus, the upper src part is
; additionally shifted left (by D5LEFTSHAMT) and OR'ed to the
; might be shifted into the lower part. Thus, the upper src part is
; additionally shifted left (by SUB1) and OR'ed to the
; right-shifted src lower part.
; CHECK-LABEL: name: test_ashr_big_scalar
; CHECK: [[E4:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[E6:%[0-9]+]]:_(s64) = COPY $e6
; CHECK: [[AMT:%[0-9]+]]:_(s32) = G_TRUNC [[E6]]
; CHECK: [[THIRTYTWO:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
; CHECK: [[D4:%[0-9]+]]:_(s32), [[D5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[E4]](s64)
; CHECK: [[ADJ_AMT:%[0-9]+]]:_(s32) = G_SUB [[AMT]], [[THIRTYTWO]]
; CHECK: [[D5LEFTSHAMT:%[0-9]+]]:_(s32) = G_SUB [[THIRTYTWO]], [[AMT]]
; CHECK: [[ZERO:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; CHECK: [[CMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AMT]](s32), [[THIRTYTWO]]
; CHECK: [[LESS32BIT:%[0-9]+]]:_(s1) = G_TRUNC [[CMP]](s32)
; CHECK: [[ISZERO:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AMT]](s32), [[ZERO]]
; CHECK: [[ISZERORES:%[0-9]+]]:_(s1) = G_TRUNC [[ISZERO]](s32)
; CHECK: [[D5ASHR:%[0-9]+]]:_(s32) = G_ASHR [[D5]], [[AMT]]
; CHECK: [[D4LSHR:%[0-9]+]]:_(s32) = G_LSHR [[D4]], [[AMT]]
; CHECK: [[D5SHL:%[0-9]+]]:_(s32) = G_SHL [[D5]], [[D5LEFTSHAMT]]
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[D4LSHR]], [[D5SHL]]
; CHECK: [[THIRTYONE:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
; CHECK: [[D5ASHR31:%[0-9]+]]:_(s32) = G_ASHR [[D5]], [[THIRTYONE]]
; CHECK: [[UPPER2LOWER:%[0-9]+]]:_(s32) = G_ASHR [[D5]], [[ADJ_AMT]]
; CHECK: [[D4RES:%[0-9]+]]:_(s32) = G_SELECT [[LESS32BIT]](s1), [[OR]], [[UPPER2LOWER]]
; CHECK: [[LOWER:%[0-9]+]]:_(s32) = G_SELECT [[ISZERORES]](s1), [[D4]], [[D4RES]]
; CHECK: [[UPPER:%[0-9]+]]:_(s32) = G_SELECT [[LESS32BIT]](s1), [[D5ASHR]], [[D5ASHR31]]
; CHECK: [[RES:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOWER]](s32), [[UPPER]](s32)
; CHECK: $e2 = COPY [[RES]](s64)
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $e6
; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC]], [[C]]
; CHECK: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], [[TRUNC]]
; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s32), [[C]]
; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s32), [[C1]]
; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[UV1]], [[TRUNC]](s32)
; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[UV]], [[TRUNC]](s32)
; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[UV1]], [[SUB1]](s32)
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL]]
; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[UV1]], [[C2]](s32)
; CHECK: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[UV1]], [[SUB]](s32)
; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC1]](s1), [[OR]], [[ASHR2]]
; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC2]](s1), [[UV]], [[SELECT]]
; CHECK: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC1]](s1), [[ASHR]], [[ASHR1]]
; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[SELECT1]](s32), [[SELECT2]](s32)
; CHECK: $e2 = COPY [[MV]](s64)
%0:_(s64) = COPY $e4
%1:_(s64) = COPY $e6
%2:_(s64) = G_ASHR %0, %1
Expand Down
55 changes: 28 additions & 27 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-integer-cmp.mir
@@ -1,3 +1,4 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

# No need to test G_ICMP with result type != s1 as this cannot be encountered in the wild. AArch64 also does not support it.
Expand All @@ -9,10 +10,10 @@ body: |
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $a5
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](p0), [[COPY1]]
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]]
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[CONST]]
; CHECK: $d2 = COPY [[AND]]
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
; CHECK: $d2 = COPY [[AND]](s32)
%0:_(p0) = COPY $a4
%1:_(p0) = COPY $a5
%2:_(s1) = G_ICMP intpred(ult), %0(p0), %1
Expand All @@ -32,10 +33,10 @@ body: |
; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s16)
; CHECK: [[SEXT1:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC1]](s16)
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SEXT]](s32), [[SEXT1]]
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]]
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[CONST]]
; CHECK: $d2 = COPY [[AND]]
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
; CHECK: $d2 = COPY [[AND]](s32)
%0:_(s32) = COPY $d4
%1:_(s32) = COPY $d5
%2:_(s16) = G_TRUNC %0(s32)
Expand All @@ -53,10 +54,10 @@ body: |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d5
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]]
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[CONST]]
; CHECK: $d2 = COPY [[AND]]
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
; CHECK: $d2 = COPY [[AND]](s32)
%0:_(s32) = COPY $d4
%1:_(s32) = COPY $d5
%2:_(s1) = G_ICMP intpred(slt), %0(s32), %1
Expand All @@ -69,21 +70,21 @@ name: test_icmp_s64
body: |
bb.0.entry:
; CHECK-LABEL: name: test_icmp_s64
; CHECK: [[E4:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[E6:%[0-9]+]]:_(s64) = COPY $e6
; CHECK: [[E4_LOWER:%[0-9]+]]:_(s32), [[E4_UPPER:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[E4]](s64)
; CHECK: [[E6_LOWER:%[0-9]+]]:_(s32), [[E6_UPPER:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[E6]](s64)
; CHECK: [[SLT:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[E4_UPPER]](s32), [[E6_UPPER]]
; CHECK: [[EQ:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[E4_UPPER]](s32), [[E6_UPPER]]
; CHECK: [[EQ_TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[EQ]](s32)
; CHECK: [[ULT:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[E4_LOWER]](s32), [[E6_LOWER]]
; CHECK: [[ULT_COPY:%[0-9]+]]:_(s32) = COPY [[ULT]](s32)
; CHECK: [[SLT_COPY:%[0-9]+]]:_(s32) = COPY [[SLT]](s32)
; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[EQ_TRUNC]](s1), [[ULT_COPY]], [[SLT_COPY]]
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT]]
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[CONST]]
; CHECK: $d2 = COPY [[AND]]
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $e6
; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](s64)
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[UV1]](s32), [[UV3]]
; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[UV1]](s32), [[UV3]]
; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
; CHECK: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[UV]](s32), [[UV2]]
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP2]](s32)
; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[COPY2]], [[COPY3]]
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
; CHECK: $d2 = COPY [[AND]](s32)
%0:_(s64) = COPY $e4
%1:_(s64) = COPY $e6
%2:_(s1) = G_ICMP intpred(slt), %0(s64), %1
Expand Down
95 changes: 48 additions & 47 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-load-store.mir
@@ -1,38 +1,39 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

---
name: test_load
body: |
bb.0.entry:
; CHECK-LABEL: name: test_load
; CHECK: [[PTR:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[LOAD_s1:%[0-9]+]]:_(s32) = G_LOAD [[PTR]](p0) :: (load 1)
; CHECK: [[COPY_s1:%[0-9]+]]:_(s32) = COPY [[LOAD_s1]](s32)
; CHECK: $d2 = COPY [[COPY_s1]](s32)
; CHECK: [[LOAD_s8:%[0-9]+]]:_(s32) = G_LOAD [[PTR]](p0) :: (load 1)
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[COPY_s8:%[0-9]+]]:_(s32) = COPY [[LOAD_s8]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY_s8]], [[CONST]]
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load 1)
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD]](s32)
; CHECK: $d2 = COPY [[COPY1]](s32)
; CHECK: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load 1)
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LOAD1]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
; CHECK: $d2 = COPY [[AND]](s32)
; CHECK: [[LOAD_s16:%[0-9]+]]:_(s32) = G_LOAD [[PTR]](p0) :: (load 2)
; CHECK: [[TRUNC_s16:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD_s16]](s32)
; CHECK: [[SEXT_s16:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC_s16]](s16)
; CHECK: $d2 = COPY [[SEXT_s16]](s32)
; CHECK: [[LOAD_s32:%[0-9]+]]:_(s32) = G_LOAD [[PTR]](p0) :: (load 4)
; CHECK: $d2 = COPY [[LOAD_s32]](s32)
; CHECK: [[LOAD_s64:%[0-9]+]]:_(s64) = G_LOAD [[PTR]](p0) :: (load 8)
; CHECK: $e2 = COPY [[LOAD_s64]](s64)
; CHECK: [[LOWERED_LOAD_s64:%[0-9]+]]:_(s32) = G_LOAD [[PTR]](p0) :: (load 4)
; CHECK: [[ANYEXT_s64:%[0-9]+]]:_(s64) = G_ANYEXT [[LOWERED_LOAD_s64]](s32)
; CHECK: $e2 = COPY [[ANYEXT_s64]](s64)
; CHECK: [[LOAD_p0:%[0-9]+]]:_(p0) = G_LOAD [[PTR]](p0) :: (load 4)
; CHECK: $a2 = COPY [[LOAD_p0]](p0)
; CHECK: [[LOAD_s128_LOWER:%[0-9]+]]:_(s64) = G_LOAD [[PTR]](p0) :: (load 8, align 16)
; CHECK: [[OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[PTR]], [[OFFSET]](s32)
; CHECK: [[LOAD_s128_UPPER:%[0-9]+]]:_(s64) = G_LOAD [[PTR_ADD]](p0) :: (load 8)
; CHECK: $e2 = COPY [[LOAD_s128_LOWER]](s64)
; CHECK: $e4 = COPY [[LOAD_s128_UPPER]](s64)
; CHECK: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load 2)
; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD2]](s32)
; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s16)
; CHECK: $d2 = COPY [[SEXT]](s32)
; CHECK: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load 4)
; CHECK: $d2 = COPY [[LOAD3]](s32)
; CHECK: [[LOAD4:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8)
; CHECK: $e2 = COPY [[LOAD4]](s64)
; CHECK: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load 4)
; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[LOAD5]](s32)
; CHECK: $e2 = COPY [[ANYEXT]](s64)
; CHECK: [[LOAD6:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load 4)
; CHECK: $a2 = COPY [[LOAD6]](p0)
; CHECK: [[LOAD7:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8, align 16)
; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
; CHECK: [[LOAD8:%[0-9]+]]:_(s64) = G_LOAD [[PTR_ADD]](p0) :: (load 8)
; CHECK: $e2 = COPY [[LOAD7]](s64)
; CHECK: $e4 = COPY [[LOAD8]](s64)
%0:_(p0) = COPY $a4
%1:_(s1) = G_LOAD %0(p0) :: (load 1)
%2:_(s32) = G_ANYEXT %1(s1)
Expand Down Expand Up @@ -62,26 +63,26 @@ name: test_store
body: |
bb.0.entry:
; CHECK-LABEL: name: test_store
; CHECK: [[PTR:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[VAL:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[CONST:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[TRUNC_s1:%[0-9]+]]:_(s32) = G_TRUNC [[VAL]](s64)
; CHECK: [[COPY_CONST:%[0-9]+]]:_(s32) = COPY [[CONST]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC_s1]], [[COPY_CONST]]
; CHECK: [[TRUNC_AND:%[0-9]+]]:_(s8) = G_TRUNC [[AND]](s32)
; CHECK: G_STORE [[TRUNC_AND]](s8), [[PTR]](p0) :: (store 1)
; CHECK: [[TRUNC_s8:%[0-9]+]]:_(s8) = G_TRUNC [[VAL]](s64)
; CHECK: G_STORE [[TRUNC_s8]](s8), [[PTR]](p0) :: (store 1)
; CHECK: [[TRUNC_s16:%[0-9]+]]:_(s16) = G_TRUNC [[VAL]](s64)
; CHECK: G_STORE [[TRUNC_s16]](s16), [[PTR]](p0) :: (store 2)
; CHECK: [[TRUNC_s32:%[0-9]+]]:_(s32) = G_TRUNC [[VAL]](s64)
; CHECK: G_STORE [[TRUNC_s32]](s32), [[PTR]](p0) :: (store 4)
; CHECK: G_STORE [[VAL]](s64), [[PTR]](p0) :: (store 8)
; CHECK: G_STORE [[PTR]](p0), [[PTR]](p0) :: (store 4)
; CHECK: G_STORE [[VAL]](s64), [[PTR]](p0) :: (store 8, align 16)
; CHECK: [[OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[PTR]], [[OFFSET]](s32)
; CHECK: G_STORE [[VAL]](s64), [[PTR_ADD]](p0) :: (store 8)
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[C]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[COPY2]]
; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[AND]](s32)
; CHECK: G_STORE [[TRUNC1]](s8), [[COPY]](p0) :: (store 1)
; CHECK: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s64)
; CHECK: G_STORE [[TRUNC2]](s8), [[COPY]](p0) :: (store 1)
; CHECK: [[TRUNC3:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s64)
; CHECK: G_STORE [[TRUNC3]](s16), [[COPY]](p0) :: (store 2)
; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
; CHECK: G_STORE [[TRUNC4]](s32), [[COPY]](p0) :: (store 4)
; CHECK: G_STORE [[COPY1]](s64), [[COPY]](p0) :: (store 8)
; CHECK: G_STORE [[COPY]](p0), [[COPY]](p0) :: (store 4)
; CHECK: G_STORE [[COPY1]](s64), [[COPY]](p0) :: (store 8, align 16)
; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
; CHECK: G_STORE [[COPY1]](s64), [[PTR_ADD]](p0) :: (store 8)
%0:_(p0) = COPY $a4
%1:_(s64) = COPY $e4
%2:_(s1) = G_TRUNC %1(s64)
Expand Down
17 changes: 9 additions & 8 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-ptr-add.mir
@@ -1,3 +1,4 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

# The legalizer has no way to legalize a G_PTR_ADD where the scalar offset is to be narrowed.
Expand All @@ -7,9 +8,9 @@ name: test_ptr_add_scalar
body: |
bb.0.entry:
; CHECK-LABEL: name: test_ptr_add_scalar
; CHECK: [[A4:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[D4:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[A4]], [[D4]]
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
; CHECK: $a2 = COPY [[PTR_ADD]](p0)
%0:_(p0) = COPY $a4
%1:_(s32) = COPY $d4
Expand All @@ -22,11 +23,11 @@ name: test_ptr_add_small_scalar
body: |
bb.0.entry:
; CHECK-LABEL: name: test_ptr_add_small_scalar
; CHECK: [[A4:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[D4:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[D4_TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[D4]](s32)
; CHECK: [[D4_SEXT:%[0-9]+]]:_(s32) = G_SEXT [[D4_TRUNC]](s8)
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[A4]], [[D4_SEXT]]
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $a4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s8)
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[SEXT]](s32)
; CHECK: $a2 = COPY [[PTR_ADD]](p0)
%0:_(p0) = COPY $a4
%1:_(s32) = COPY $d4
Expand Down

0 comments on commit 72fd77e

Please sign in to comment.