1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/Mips
Daniel Sanders 233ed83478 [globalisel] Add G_SEXT_INREG
Summary:
Targets often have instructions that can sign-extend certain cases faster
than the equivalent shift-left/arithmetic-shift-right. Such cases can be
identified by matching a shift-left/shift-right pair but there are some
issues with this in the context of combines. For example, suppose you can
sign-extend 8-bit up to 32-bit with a target extend instruction.
  %1:_(s32) = G_SHL %0:_(s32), i32 24 # (I've inlined the G_CONSTANT for brevity)
  %2:_(s32) = G_ASHR %1:_(s32), i32 24
  %3:_(s32) = G_ASHR %2:_(s32), i32 1
would reasonably combine to:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 25
which no longer matches the special case. If your shifts and extend are
equal cost, this would break even as a pair of shifts but if your shift is
more expensive than the extend then it's cheaper as:
  %2:_(s32) = G_SEXT_INREG %0:_(s32), i32 8
  %3:_(s32) = G_ASHR %2:_(s32), i32 1
It's possible to match the shift-pair in ISel and emit an extend and ashr.
However, this is far from the only way to break this shift pair and make
it hard to match the extends. Another example is that with the right
known-zeros, this:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 24
  %3:_(s32) = G_MUL %2:_(s32), i32 2
can become:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 23

All upstream targets have been configured to lower it to the current
G_SHL,G_ASHR pair but will likely want to make it legal in some cases to
handle their faster cases.

To follow-up: Provide a way to legalize based on the constant. At the
moment, I'm thinking that the best way to achieve this is to provide the
MI in LegalityQuery but that opens the door to breaking core principles
of the legalizer (legality is not context sensitive). That said, it's
worth noting that looking at other instructions and acting on that
information doesn't violate this principle in itself. It's only a
violation if, at the end of legalization, a pass that checks legality
without being able to see the context would say an instruction might not be
legal. That's a fairly subtle distinction so to give a concrete example,
saying %2 in:
  %1 = G_CONSTANT 16
  %2 = G_SEXT_INREG %0, %1
is legal is in violation of that principle if the legality of %2 depends
on %1 being constant and/or being 16. However, legalizing to either:
  %2 = G_SEXT_INREG %0, 16
or:
  %1 = G_CONSTANT 16
  %2:_(s32) = G_SHL %0, %1
  %3:_(s32) = G_ASHR %2, %1
depending on whether %1 is constant and 16 does not violate that principle
since both outputs are genuinely legal.

Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, arsenm

Subscribers: sdardis, jvesely, wdng, nhaehnle, rovka, kristof.beyls, javed.absar, hiraditya, jrtc27, atanasyan, Petar.Avramovic, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61289

llvm-svn: 368487
2019-08-09 21:11:20 +00:00
..
cconv [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
compactbranches
cstmaterialization
Fast-ISel RegAllocFast: Remove early selection loop, the spill calculation will report cost 0 anyway for free regs 2019-03-19 19:01:34 +00:00
GlobalISel [globalisel] Add G_SEXT_INREG 2019-08-09 21:11:20 +00:00
indirect-jump-hazard Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
instverify Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
llvm-ir [mips] Use mult/mflo pattern on 64-bit targets prior to MIPS64 2019-07-17 08:11:40 +00:00
longbranch
micromips-sizereduction Describe stack-id as an enum 2019-06-17 09:13:29 +00:00
mips32r6
mips64r6
mirparser Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
msa [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
tailcall [mips] Fix JmpLink to texternalsym and tglobaladdr on mcroMIPS R6 2019-07-12 04:58:45 +00:00
2008-06-05-Carry.ll
2008-07-03-SRet.ll
2008-07-06-fadd64.ll
2008-07-07-Float2Int.ll
2008-07-07-FPExtend.ll
2008-07-07-IntDoubleConvertions.ll
2008-07-15-InternalConstant.ll
2008-07-15-SmallSection.ll
2008-07-16-SignExtInReg.ll
2008-07-22-Cstpool.ll
2008-07-23-fpcmp.ll
2008-07-29-icmp.ll
2008-07-31-fcopysign.ll
2008-08-01-AsmInline.ll
2008-08-03-fabs64.ll
2008-08-03-ReturnDouble.ll
2008-08-04-Bitconvert.ll
2008-08-06-Alloca.ll
2008-08-07-CC.ll
2008-08-07-FPRound.ll
2008-08-08-ctlz.ll
2008-10-13-LegalizerBug.ll
2008-11-10-xint_to_fp.ll
2009-11-16-CstPoolLoad.ll
2010-07-20-Switch.ll
2010-11-09-CountLeading.ll
2010-11-09-Mul.ll
2011-05-26-BranchKillsVreg.ll
2012-12-12-ExpandMemcpy.ll
2013-11-18-fp64-const0.ll [MIPS] Remove fcmp undef from reduced test 2019-03-30 20:16:16 +00:00
abicalls.ll
abiflags32.ll [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
abiflags-xx.ll
addc.ll
addi.ll
address-selection.ll
addressing-mode.ll
adjust-callstack-sp.ll
align16.ll
alloca16.ll
alloca.ll
analyzebranch.ll
and1.ll
ase_warnings.ll
asm-large-immediate.ll
assertzext-trunc.ll
atomic64.ll [FastISel] Skip creating unnecessary vregs for arguments 2019-06-10 16:53:37 +00:00
atomic.ll [FastISel] Skip creating unnecessary vregs for arguments 2019-06-10 16:53:37 +00:00
atomicCmpSwapPW.ll [FastISel] Skip creating unnecessary vregs for arguments 2019-06-10 16:53:37 +00:00
atomicops.ll
beqzc1.ll
beqzc.ll
biggot.ll
blez_bgez.ll
blockaddr.ll
br-jmp.ll
branch-relaxation-with-hazard.ll
brconeq.ll
brconeqk.ll
brconeqz.ll
brconge.ll
brcongt.ll
brconle.ll
brconlt.ll
brconne.ll
brconnek.ll
brconnez.ll
brdelayslot.ll
brind-tailcall.ll
brind.ll
brsize3.ll
brsize3a.ll
brundef.ll
bswap.ll
buildpairextractelementf64.ll
buildpairf64-extractelementf64-implicit-sp.ll Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
cache-intrinsic.ll
call-optimization.ll
cfi_offset.ll [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
check-adde-redundant-moves.ll
check-noat.ll
ci2.ll
cins.ll
cmov.ll
cmplarge.ll
coalesce-partial-redundant-reguse-terminator.mir
const1.ll
const4a.ll
const6.ll
const6a.ll
const-mult.ll [DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952) 2019-06-04 11:06:21 +00:00
constantfp0.ll
constraint-c-err.ll
constraint-c.ll
copy-fp64.ll [Mips][Codegen] Fix fast-isel mixing of FGR64 and AFGR64 registers 2019-08-09 12:02:32 +00:00
countleading.ll
cprestore.ll
ctlz-v.ll
ctlz.ll
cttz-v.ll
dagcombine_crash.ll
dagcombine-store-gep-chain-slow.ll
DbgValueOtherTargets.test
delay-slot-fill-forward.ll
delay-slot-kill.ll
dext.ll
dins.ll
disable-tail-merge.ll
div_rem.ll
div.ll
divrem.ll
divu_remu.ll
divu.ll
double2int.ll
dsp-patterns-cmp-vselect.ll
dsp-patterns.ll
dsp-r1.ll
dsp-r2.ll
dsp-spill-reload.ll [FastISel] Skip creating unnecessary vregs for arguments 2019-06-10 16:53:37 +00:00
dsp-vec-load-store.ll
dynamic-stack-realignment.ll [MIPS][microMIPS] Enable dynamic stack realignment 2019-03-19 17:01:24 +00:00
eh-dwarf-cfa.ll
eh-return32.ll
eh-return64.ll
eh.ll
ehframe-indirect.ll
elf_eflags.ll
emergency-spill-slot-near-fp.ll
emit-big-cst.ll
emutls_generic.ll
ex2.ll
extins.ll
f16abs.ll
f32-to-i64-single-float.ll
fabs.ll
fastcc_byval.ll
fastcc.ll
fcmp.ll
fcopysign-f32-f64.ll
fcopysign.ll
fixdfsf.ll
fmadd1.ll
fneg.ll
fp16-promote.ll
fp16instrinsmc.ll
fp16mix.ll
fp16static.ll
fp64a.ll [mips] Show error in case of using FP64 mode on pre MIPS32R2 CPU 2019-07-09 15:48:16 +00:00
fp-contract.ll [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
fp-indexed-ls.ll
fp-spill-reload.ll
fpbr.ll
fpneeded.ll
fpnotneeded.ll
fpxx.ll
frame-address-err.ll [mips] Replace assertion by error message while lowering RETURNADDR and FRAMEADDR 2019-03-06 22:40:28 +00:00
frame-address.ll
frameindex.ll
frem.ll
global-address.ll
global-pointer-reg.ll
gpopt-explict-section.ll
gpreg-lazy-binding.ll
gprestore.ll
helloworld.ll
hf1_body.ll
hf16_1.ll
hf16call32_body.ll
hf16call32.ll
hfptrcall.ll
i32k.ll
i64arg.ll
imm.ll
indirectcall.ll
init-array.ll [IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format 2019-05-15 02:35:32 +00:00
inlineasm-assembler-directives.ll
inlineasm-constraint-bad-I-1.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-J.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-K.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-l1.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-L.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-N.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-O.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-bad-P.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-i1.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-m-1.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-m-2.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-o.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-R.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-reg64.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-reg.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-ZC-1.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint-ZC-2.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-constraint.ll [mips] Name inline asm constraint test cases in a uniform manner. NFC 2019-07-17 08:11:57 +00:00
inlineasm-opcode-bad-y.ll
inlineasm-operand-code.ll
inlineasm-output-template.ll [AsmPrinter] refactor to support %c w/ GlobalAddress' 2019-04-26 18:45:04 +00:00
insn-zero-size-bb.ll
int-to-float-conversion.ll
internalfunc.ll Revert r361356: "[MIR] Add simple PRE pass to MachineCSE" 2019-05-27 06:00:00 +00:00
interrupt-attr-64-error.ll
interrupt-attr-args-error.ll
interrupt-attr-error.ll
interrupt-attr.ll
jtstat.ll
jump-table-mul.ll
jumptable_labels.ll
l3mc.ll
largeimm1.ll
largeimmprinting.ll
lazy-binding.ll
lb1.ll
lbu1.ll
lcb2.ll
lcb3c.ll
lcb4a.ll
lcb5.ll
lh1.ll
lhu1.ll
lit.local.cfg [lit] Delete empty lines at the end of lit.local.cfg NFC 2019-06-17 09:51:07 +00:00
llcarry.ll
llrint-conv.ll [CodeGen] Add lrint/llrint builtins 2019-05-28 20:47:44 +00:00
llround-conv.ll [CodeGen] Add lround/llround builtins 2019-05-16 13:15:27 +00:00
load-store-left-right.ll
long-call-attr.ll
long-call-mcount.ll
long-calls.ll
longbranch.ll
lrint-conv.ll [CodeGen] Add lrint/llrint builtins 2019-05-28 20:47:44 +00:00
lround-conv.ll [CodeGen] Add lround/llround builtins 2019-05-16 13:15:27 +00:00
lw16-base-reg.ll
machineverifier.ll
madd-msub.ll [DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952) 2019-06-04 11:06:21 +00:00
mature-mc-support.ll
mbrsize4a.ll
memcpy.ll
micromips64-unsupported.ll
micromips-addiu.ll
micromips-addu16.ll
micromips-and16.ll
micromips-andi.ll
micromips-ase-function-attribute.ll [llvm-readobj] Change -long-option to --long-option in tests. NFC 2019-05-01 05:27:20 +00:00
micromips-atomic1.ll
micromips-atomic.ll
micromips-attr.ll
micromips-b-range.ll
micromips-compact-branches.ll
micromips-compact-jump.ll
micromips-delay-slot-jr.ll
micromips-delay-slot.ll [mips] Fix JmpLink to texternalsym and tglobaladdr on mcroMIPS R6 2019-07-12 04:58:45 +00:00
micromips-directives.ll
micromips-eva.mir Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
micromips-gcc-except-table.ll
micromips-gp-rc.ll
micromips-jal.ll
micromips-li.ll
micromips-load-effective-address.ll
micromips-lwc1-swc1.ll
micromips-mtc-mfc.ll [mips] Fix encoding of the mov.d command for microMIPS R6 2019-03-13 14:23:12 +00:00
micromips-not16.ll
micromips-or16.ll
micromips-pseudo-mtlohi-expand.ll [mips] Use reg-exp in tests to tolerate register indexes changing. NFC 2019-05-29 14:59:07 +00:00
micromips-rdhwr-directives.ll
micromips-shift.ll
micromips-short-delay-slot.mir Describe stack-id as an enum 2019-06-17 09:13:29 +00:00
micromips-subu16.ll
micromips-sw-lw-16.ll
micromips-sw.ll [mips] Map SW instruction to its microMIPS R6 variant 2019-03-13 13:09:30 +00:00
micromips-target-external-symbol-reloc.ll [mips] Fix JmpLink to texternalsym and tglobaladdr on mcroMIPS R6 2019-07-12 04:58:45 +00:00
micromips-xor16.ll
mips3-spill-slot.ll
mips16_32_1.ll
mips16_32_3.ll
mips16_32_4.ll
mips16_32_5.ll
mips16_32_6.ll
mips16_32_7.ll
mips16_32_8.ll
mips16_32_9.ll
mips16_32_10.ll
mips16_fpret.ll
mips16-hf-attr-2.ll
mips16-hf-attr.ll
mips16ex.ll
mips16fpe.ll
mips64-f128-call.ll
mips64-f128.ll
mips64-libcall.ll
mips64-sret.ll
mips64directive.ll
mips64ext.ll
mips64extins.ll
mips64fpimm0.ll
mips64fpldst.ll
mips64imm.ll
mips64instrs.ll
mips64intldst.ll
mips64lea.ll
mips64muldiv.ll
mips64shift.ll
mips64signextendsesf.ll
mips64sinttofpsf.ll
mips-shf-gprel.s [llvm-readobj] Change -long-option to --long-option in tests. NFC 2019-05-01 05:27:20 +00:00
mipslopat.ll
misha.ll
mno-ldc1-sdc1.ll
mul.ll
mulll.ll
mulull.ll
nacl-align.ll
nacl-branch-delay.ll
nacl-reserved-regs.ll
named-register-n32.ll
named-register-n64.ll
named-register-o32.ll
neg1.ll
nmadd.ll
no-odd-spreg-msa.ll [mips] Use AltOrders to prevent using odd FP-registers 2019-04-02 13:57:32 +00:00
no-odd-spreg.ll
nomips16.ll
not1.ll
null-streamer.ll
null.ll
o32_cc_byval.ll
o32_cc_vararg.ll
o32_cc.ll
octeon_popcnt.ll
octeon.ll
optimize-fp-math.ll
optimize-pic-o0.ll
or1.ll
pbqp-reserved-physreg.ll
powif64_16.ll
pr33682.ll
pr33978.ll
pr34975.ll
pr35071.ll
pr36061.ll
prevent-hoisting.ll
private-addr.ll
private.ll
pseudo-jump-fill.ll
ra-allocatable.ll
rdhwr-directives.ll
reloc-jalr.ll
rem.ll
remat-immed-load.ll
remu.ll
return_address_err.ll [mips] Replace assertion by error message while lowering RETURNADDR and FRAMEADDR 2019-03-06 22:40:28 +00:00
return_address.ll
return-vector.ll
rotate.ll
s2rem.ll
sb1.ll
sel1c.ll
sel2c.ll
select.ll
selectcc.ll
selectiondag-optlevel.ll
seleq.ll
seleqk.ll
selgek.ll
selgt.ll
selle.ll
selltk.ll
selne.ll
selnek.ll
selpat.ll
selTBteqzCmpi.ll
selTBtnezCmpi.ll
selTBtnezSlti.ll
setcc-se.ll
seteq.ll
seteqz.ll
setge.ll
setgek.ll
setle.ll
setlt.ll
setltk.ll
setne.ll
setuge.ll
setugt.ll
setule.ll
setult.ll
setultk.ll
sh1.ll
shift-parts.ll
shrink-wrap-buildpairf64-extractelementf64.mir
shrink-wrapping.ll
simplebr.ll
sint-fp-store_pattern.ll
sitofp-selectcc-opt.ll
sll1.ll
sll2.ll
sll-micromips-r6-encoding.mir
slt.ll
small-section-reserve-gp.ll
spill-copy-acreg.ll
sr1.ll
sra1.ll
sra2.ll
srl1.ll
srl2.ll
stack-alignment.ll [mips] Explicitly select mips32r2 CPU for test cases require 64-bit FPU. NFC 2019-07-09 15:48:05 +00:00
stackcoloring.ll
stacksize.ll
start-asm-file.ll
stchar.ll
stldst.ll
sub1.ll
sub2.ll
swzero.ll
tail16.ll
tglobaladdr-wrapper.ll
thread-pointer.ll
tls16_2.ll
tls16.ll
tls-alias.ll
tls-models.ll
tls.ll
tnaked.ll
trap1.ll
trap.ll
uitofp.ll
ul1.ll
unaligned-memops-mapping.mir Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
unaligned-memops.ll Rename ExpandISelPseudo->FinalizeISel, delay register reservation 2019-06-19 00:25:39 +00:00
unalignedload.ll
unsized-global.ll
v2i16tof32.ll [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00
vector-load-store.ll
vector-setcc.ll
weak.ll
whitespace.ll
xor1.ll
xray-mips-attribute-instrumentation.ll
xray-section-group.ll [llvm-readobj] Change -long-option to --long-option in tests. NFC 2019-05-01 05:27:20 +00:00
zeroreg.ll