mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
5d4c0a60e2
Other opcodes shouldn't be CSE'd until we can be sure debug info quality won't be degraded. This change also improves the IRTranslator so that in most places, but not all, it creates constants using the MIRBuilder directly instead of first creating a new destination vreg and then creating a constant. By doing this, the buildConstant() method can just return the vreg of an existing G_CONSTANT instead of having to create a COPY from it. I measured a 0.2% improvement in compile time and a 0.9% improvement in code size at -O0 ARM64. Compile time: Program base cse diff test-suite...ark/tramp3d-v4/tramp3d-v4.test 9.04 9.12 0.8% test-suite...Mark/mafft/pairlocalalign.test 2.68 2.66 -0.7% test-suite...-typeset/consumer-typeset.test 5.53 5.51 -0.4% test-suite :: CTMark/lencod/lencod.test 5.30 5.28 -0.3% test-suite :: CTMark/Bullet/bullet.test 25.82 25.76 -0.2% test-suite...:: CTMark/ClamAV/clamscan.test 6.92 6.90 -0.2% test-suite...TMark/7zip/7zip-benchmark.test 34.24 34.17 -0.2% test-suite :: CTMark/SPASS/SPASS.test 6.25 6.24 -0.1% test-suite...:: CTMark/sqlite3/sqlite3.test 1.66 1.66 -0.1% test-suite :: CTMark/kimwitu++/kc.test 13.61 13.60 -0.0% Geomean difference -0.2% Code size: Program base cse diff test-suite...-typeset/consumer-typeset.test 1315632 1266480 -3.7% test-suite...:: CTMark/ClamAV/clamscan.test 1313892 1297508 -1.2% test-suite :: CTMark/lencod/lencod.test 1439504 1423112 -1.1% test-suite...TMark/7zip/7zip-benchmark.test 2936980 2904172 -1.1% test-suite :: CTMark/Bullet/bullet.test 3478276 3445460 -0.9% test-suite...ark/tramp3d-v4/tramp3d-v4.test 8082868 8033492 -0.6% test-suite :: CTMark/kimwitu++/kc.test 3870380 3853972 -0.4% test-suite :: CTMark/SPASS/SPASS.test 1434904 1434896 -0.0% test-suite...Mark/mafft/pairlocalalign.test 764528 764528 0.0% test-suite...:: CTMark/sqlite3/sqlite3.test 782092 782092 0.0% Geomean difference -0.9% Differential Revision: https://reviews.llvm.org/D60580 llvm-svn: 358369
177 lines
5.8 KiB
YAML
177 lines
5.8 KiB
YAML
# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=+v5t -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,CLZ
|
|
# RUN: llc -O0 -mtriple thumb-linux-gnueabi -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,CLZ
|
|
# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=-v5t -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,LIBCALLS
|
|
--- |
|
|
define void @test_ctlz_s32() { ret void }
|
|
define void @test_ctlz_zero_undef_s32() { ret void }
|
|
|
|
; same as above but with extensions
|
|
define void @test_ctlz_s16() { ret void }
|
|
define void @test_ctlz_zero_undef_s8() { ret void }
|
|
...
|
|
---
|
|
name: test_ctlz_s32
|
|
# CHECK-LABEL: name: test_ctlz_s32
|
|
legalized: false
|
|
# CHECK: legalized: true
|
|
regBankSelected: false
|
|
selected: false
|
|
tracksRegLiveness: true
|
|
registers:
|
|
- { id: 0, class: _ }
|
|
- { id: 1, class: _ }
|
|
body: |
|
|
bb.0:
|
|
liveins: $r0
|
|
|
|
; CHECK: [[X:%[0-9]+]]:_(s32) = COPY $r0
|
|
%0(s32) = COPY $r0
|
|
|
|
; CLZ: [[R:%[0-9]+]]:_(s32) = G_CTLZ [[X]]
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: ADJCALLSTACKDOWN
|
|
; LIBCALLS: $r0 = COPY [[X]]
|
|
; LIBCALLS: BL &__clzsi2, {{.*}}, implicit $r0, implicit-def $r0
|
|
; LIBCALLS: [[COUNT:%[0-9]+]]:_(s32) = COPY $r0
|
|
; LIBCALLS: ADJCALLSTACKUP
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: [[ZERO:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
|
|
; LIBCALLS: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
|
|
; LIBCALLS: [[CMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[X]](s32), [[ZERO]]
|
|
; LIBCALLS: [[R:%[0-9]+]]:_(s32) = G_SELECT [[CMP]](s1), [[BITS]], [[COUNT]]
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
%1(s32) = G_CTLZ %0
|
|
|
|
; CHECK: $r0 = COPY [[R]]
|
|
$r0 = COPY %1(s32)
|
|
BX_RET 14, $noreg, implicit $r0
|
|
...
|
|
---
|
|
name: test_ctlz_zero_undef_s32
|
|
# CHECK-LABEL: name: test_ctlz_zero_undef_s32
|
|
legalized: false
|
|
# CHECK: legalized: true
|
|
regBankSelected: false
|
|
selected: false
|
|
tracksRegLiveness: true
|
|
registers:
|
|
- { id: 0, class: _ }
|
|
- { id: 1, class: _ }
|
|
body: |
|
|
bb.0:
|
|
liveins: $r0
|
|
|
|
; CHECK: [[X:%[0-9]+]]:_(s32) = COPY $r0
|
|
%0(s32) = COPY $r0
|
|
|
|
; CLZ: [[R:%[0-9]+]]:_(s32) = G_CTLZ [[X]]
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: ADJCALLSTACKDOWN
|
|
; LIBCALLS: $r0 = COPY [[X]]
|
|
; LIBCALLS: BL &__clzsi2, {{.*}}, implicit $r0, implicit-def $r0
|
|
; LIBCALLS: [[R:%[0-9]+]]:_(s32) = COPY $r0
|
|
; LIBCALLS: ADJCALLSTACKUP
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
%1(s32) = G_CTLZ_ZERO_UNDEF %0
|
|
|
|
; CHECK: $r0 = COPY [[R]]
|
|
$r0 = COPY %1(s32)
|
|
BX_RET 14, $noreg, implicit $r0
|
|
...
|
|
---
|
|
name: test_ctlz_s16
|
|
# CHECK-LABEL: name: test_ctlz_s16
|
|
legalized: false
|
|
# CHECK: legalized: true
|
|
regBankSelected: false
|
|
selected: false
|
|
tracksRegLiveness: true
|
|
registers:
|
|
- { id: 0, class: _ }
|
|
- { id: 1, class: _ }
|
|
- { id: 2, class: _ }
|
|
- { id: 3, class: _ }
|
|
body: |
|
|
bb.0:
|
|
liveins: $r0
|
|
|
|
; CHECK: [[X:%[0-9]+]]:_(s32) = COPY $r0
|
|
; CHECK: [[BITMASK:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
|
|
; CHECK: [[XAGAIN:%[0-9]+]]:_(s32) = COPY [[X]]
|
|
; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[XAGAIN]], [[BITMASK]]
|
|
%0(s32) = COPY $r0
|
|
%1(s16) = G_TRUNC %0(s32)
|
|
|
|
; Check that the operation is performed for 32 bits
|
|
; CLZ: [[COUNT:%[0-9]+]]:_(s32) = G_CTLZ [[X32]]
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: ADJCALLSTACKDOWN
|
|
; LIBCALLS: $r0 = COPY [[X32]]
|
|
; LIBCALLS: BL &__clzsi2, {{.*}}, implicit $r0, implicit-def $r0
|
|
; LIBCALLS: [[UNDEFCOUNT:%[0-9]+]]:_(s32) = COPY $r0
|
|
; LIBCALLS: ADJCALLSTACKUP
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: [[ZERO:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
|
|
; LIBCALLS: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
|
|
; LIBCALLS: [[CMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), {{%[0-9]+}}(s32), [[ZERO]]
|
|
; LIBCALLS: [[COUNT:%[0-9]+]]:_(s32) = G_SELECT [[CMP]](s1), [[BITS]], [[UNDEFCOUNT]]
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; CHECK: [[BITDIFF:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
|
|
; CHECK: [[R32:%[0-9]+]]:_(s32) = G_SUB [[COUNT]], [[BITDIFF]]
|
|
%2(s16) = G_CTLZ %1
|
|
|
|
; CHECK: [[RAGAIN:%[0-9]+]]:_(s32) = COPY [[R32]]
|
|
; CHECK: [[SHIFTEDR:%[0-9]+]]:_(s32) = G_SHL [[RAGAIN]], [[BITDIFF]]
|
|
; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDR]], [[BITDIFF]]
|
|
; CHECK: $r0 = COPY [[R]]
|
|
%3(s32) = G_SEXT %2(s16)
|
|
$r0 = COPY %3(s32)
|
|
BX_RET 14, $noreg, implicit $r0
|
|
...
|
|
---
|
|
name: test_ctlz_zero_undef_s8
|
|
# CHECK-LABEL: name: test_ctlz_zero_undef_s8
|
|
legalized: false
|
|
# CHECK: legalized: true
|
|
regBankSelected: false
|
|
selected: false
|
|
tracksRegLiveness: true
|
|
registers:
|
|
- { id: 0, class: _ }
|
|
- { id: 1, class: _ }
|
|
- { id: 2, class: _ }
|
|
- { id: 3, class: _ }
|
|
body: |
|
|
bb.0:
|
|
liveins: $r0
|
|
|
|
; CHECK: [[X:%[0-9]+]]:_(s32) = COPY $r0
|
|
; CHECK: [[BITMASK:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
|
|
; CHECK: [[XAGAIN:%[0-9]+]]:_(s32) = COPY [[X]]
|
|
; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[XAGAIN]], [[BITMASK]]
|
|
%0(s32) = COPY $r0
|
|
%1(s8) = G_TRUNC %0(s32)
|
|
|
|
; Check that the operation is performed for 32 bits
|
|
; CLZ: [[COUNT:%[0-9]+]]:_(s32) = G_CTLZ
|
|
; CLZ-NOT: G_CTLZ_ZERO_UNDEF
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; LIBCALLS: ADJCALLSTACKDOWN
|
|
; LIBCALLS: $r0 = COPY [[X32]]
|
|
; LIBCALLS: BL &__clzsi2, {{.*}}, implicit $r0, implicit-def $r0
|
|
; LIBCALLS: [[COUNT:%[0-9]+]]:_(s32) = COPY $r0
|
|
; LIBCALLS: ADJCALLSTACKUP
|
|
; LIBCALLS-NOT: G_CTLZ
|
|
; CHECK: [[BITDIFF:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
|
|
; CHECK: [[R32:%[0-9]+]]:_(s32) = G_SUB [[COUNT]], [[BITDIFF]]
|
|
%2(s8) = G_CTLZ_ZERO_UNDEF %1
|
|
|
|
; CHECK: [[RAGAIN:%[0-9]+]]:_(s32) = COPY [[R32]]
|
|
; CHECK: [[SHIFTEDR:%[0-9]+]]:_(s32) = G_SHL [[RAGAIN]], [[BITDIFF]]
|
|
; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDR]], [[BITDIFF]]
|
|
; CHECK: $r0 = COPY [[R]]
|
|
%3(s32) = G_SEXT %2(s8)
|
|
$r0 = COPY %3(s32)
|
|
BX_RET 14, $noreg, implicit $r0
|
|
...
|