Commit Graph

1383 Commits

Author SHA1 Message Date
Petar Avramovic
d98749c59f [MIPS GlobalISel] Select floating point arithmetic operations
Select 32 and 64 bit floating point add, sub, mul and div for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357584 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-03 14:12:59 +00:00
Simon Atanasyan
7ce65e1e74 [mips] Use AltOrders to prevent using odd FP-registers
To disable using of odd floating-point registers (O32 ABI and
-mno-odd-spreg command line option) such registers and their
super-registers added to the set of reserved registers. In general, it
works. But there is at least one problem - in case of enabled machine
verifier pass some floating-point tests failed because live ranges of
register units that are reserved is not empty and verification pass
failed with "Live segment doesn't end at a valid instruction" error
message.

There is D35985 patch which tries to solve the problem by explicit
removing of register units. This solution did not get approval.

I would like to use another approach for prevent using odd floating
point registers - define `AltOrders` and `AltOrderSelect` for MIPS
floating point register classes. Such `AltOrders` contains reduced set
of registers. At first glance, such solution does not break any test
cases and allows enabling machine instruction verification for all MIPS
test cases.

Differential Revision: http://reviews.llvm.org/D59799

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357472 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 13:57:32 +00:00
Simon Pilgrim
c6c65fd702 [MIPS] Remove fcmp undef from reduced test
Pre-commit for D60006 (Add fcmp UNDEF handling to SelectionDAG::FoldSetCC)

Approved by @atanasyan (Simon Atanasyan)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357354 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-30 20:16:16 +00:00
Simon Pilgrim
b5762155f7 [MIPS] Regenerate double constant comparison test
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357294 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-29 18:22:18 +00:00
Simon Atanasyan
5a3c3d4774 [mips] Fix lowering a signed immediate for *.d MSA instructions
The `lowerMSASplatImm` function zero-extends `i32` immediates while
building constant. If target type is `i64`, negative immediate loses
the sign. As a result, for example `__builtin_msa_ldi_d(-1)` lowered
to series of instruction loads incorrect value 0xffffffff to the `$w0`
register instead of single `ldi.d $w0, -1` instruction.

The fix zero-extends unsigned immediates and signed-extend signed
immediates.

Differential Revision: http://reviews.llvm.org/D59884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357264 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-29 15:15:22 +00:00
Petar Avramovic
fbfa7eae2f [MIPS GlobalISel] Select float constants
Select 32 and 64 bit float constants for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357183 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 16:58:12 +00:00
Nirav Dave
b4adfc21eb Revert r356996 "[DAG] Avoid smart constructor-based dangling nodes."
This patch appears to trigger very large compile time increases in
halide builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357116 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 19:54:41 +00:00
Amara Emerson
a3e702346e [GlobalISel] Fix legalizer artifact combiner from crashing with invalid dead instructions.
The artifact combiners push instructions which have been marked for deletion
onto an list for the legalizer to deal with on return. However, for trunc(ext)
combines the combiner routine recursively calls itself. When it does this the
dead instructions list may not be empty, and the other combiners don't expect
to be dealing with essentially invalid MIR (multiple vreg defs etc).

This change fixes it by ensuring that the dead instructions are processed on
entry into tryCombineInstruction.

As a result, this fix exposed a few places in tests where G_TRUNC instructions
were not being deleted even though they were dead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357101 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 17:47:42 +00:00
Nirav Dave
de6ac6d211 [DAG] Avoid smart constructor-based dangling nodes.
Various SelectionDAG non-combine operations (e.g. the getNode smart
constructor and legalization) may leave dangling nodes by applying
optimizations or not fully pruning unused result values. This can
result in nodes that are never added to the worklist and therefore can
not be pruned.

Add a node inserter as the current node deleter to make sure such
nodes have the chance of being pruned.

Many minor changes, mostly positive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356996 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-26 15:08:14 +00:00
Petar Avramovic
29ab38eb24 [MIPS GlobalISel] Select copy for arguments from FPRBRegBank
Move selectCopy into MipsInstructionSelector class.
Select copy for arguments from FPRBRegBank for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-25 11:38:06 +00:00
Petar Avramovic
f636c26bde [MIPS GlobalISel] Add floating point register bank
Add floating point register bank for MIPS32.
Implement getRegBankFromRegClass for float register classes.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356883 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-25 11:30:46 +00:00
Petar Avramovic
ce7cb683c2 [MIPS GlobalISel] Lower float and double arguments in registers
Lower float and double arguments in registers for MIPS32.
When float/double argument is passed through gpr registers
select appropriate move instruction.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-25 11:23:41 +00:00
Matt Arsenault
e286751049 Mips: Don't create copy of nothing
This was creating a copy of the register the pseudo itself was
def'ing, leaving a copy of an undefined register. I'm not sure how
the verifier is not catching this, but this avoids asserting in a
future change to RegAllocFast

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356716 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 20:56:05 +00:00
Matt Arsenault
51c2ad77cd RegAllocFast: Remove early selection loop, the spill calculation will report cost 0 anyway for free regs
The 2nd loop calculates spill costs but reports free registers as cost
0 anyway, so there is little benefit from having a separate early
loop.

Surprisingly this is not NFC, as many register are marked regDisabled
so the first loop often picks up later registers unnecessarily instead
of the first one available in the allocation order...

Patch by Matthias Braun

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356499 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:01:34 +00:00
Simon Atanasyan
95f0c9ffc7 [MIPS][microMIPS] Enable dynamic stack realignment
Dynamic stack realignment was disabled on micromips by checking if
target has standard encoding. We simply change the condition to skip
Mips16 only.

Patch by Mirko Brkusanin.

Differential Revision: http://reviews.llvm.org/D59499

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356478 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 17:01:24 +00:00
Petar Avramovic
20744f0b1f [MIPS GlobalISel] Improve selection of constants
Certain 32 bit constants can be generated with a single instruction
instead of two. Implement materialize32BitImm function for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356238 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-15 07:07:50 +00:00
Quentin Colombet
79ad8c5d84 [GlobalISel][Utils] Add a getConstantVRegVal variant that looks through instrs
getConstantVRegVal used to only look for G_CONSTANT when looking at
unboxing the value of a vreg. However, constants are sometimes not
directly used and are hidden behind trunc, s|zext or copy chain of
computation.

In particular this may be introduced by the legalization process that
doesn't want to simplify these patterns because it can lead to infine
loop when legalizing a constant.

To circumvent that problem, add a new variant of getConstantVRegVal,
named getConstantVRegValWithLookThrough, that allow to look through
extensions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356116 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 01:37:13 +00:00
Douglas Yung
c8c4a42242 Fixup tests to check for any MCInst number instead of a specific one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356115 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 01:24:35 +00:00
Matt Arsenault
f3a3d43965 Mips: Add ImmArg to intrinsics
I found these by asserting in clang for any GCCBuiltin that doesn't
require mangling and requires a constant for the builtin. This means
that intrinsics are missing which don't use GCCBuiltin, don't have
builtins defined in clang, or were missing the constant annotation in
the builtin definition.

I'm not sure what's going on with the immediates.ll test. It seems to
be intended to test invalid cases like this, but then tries to handle
some of them anyway. I've moved the cases that were inconsistent with
the GCCBuiltin definition so they don't test the codegen anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356085 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 19:07:59 +00:00
Nirav Dave
154874adc5 [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later.
Summary:
A number of optimizations are inhibited by single-use TokenFactors not
being merged into the TokenFactor using it. This makes we consider if
we can do the merge immediately.

Most tests changes here are due to the change in visitation causing
minor reorderings and associated reassociation of paired memory
operations.

CodeGen tests with non-reordering changes:

  X86/aligned-variadic.ll -- memory-based add folded into stored leaq
  value.

  X86/constant-combiners.ll -- Optimizes out overlap between stores.

  X86/pr40631_deadstore_elision -- folds constant byte store into
  preceding quad word constant store.

Reviewers: RKSimon, craig.topper, spatel, efriedma, courbet

Reviewed By: courbet

Subscribers: dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, eraman, hiraditya, kbarton, jrtc27, atanasyan, jsji, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356068 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 17:07:09 +00:00
Simon Atanasyan
a63c4ac08c [mips] Fix encoding of the mov.d command for microMIPS R6
Before this change LLVM emits non-microMIPS variant of the `mov.d`
command for microMIPS code.

Differential Revision: http://reviews.llvm.org/D59045

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356052 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 14:23:12 +00:00
Simon Atanasyan
e853018a81 [mips] Map SW instruction to its microMIPS R6 variant
To provide mapping between standard and microMIPS R6 variants of the
`sw` command we have to rename SWSP_xxx commands from "sw" to "swsp".
Otherwise `tablegen` starts to show the error `Multiple matches found
for `SW'`. After that to restore printing SWSP command as `sw`, I add
an appropriate `MipsInstAlias` instance.

We also need to implement "size reduction" for microMIPS R6. But this
task is for separate patch. After that the `micromips-lwsp-swsp.ll` test
case will be extended.

Differential Revision: http://reviews.llvm.org/D59046

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356045 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 13:09:30 +00:00
Simon Atanasyan
4113ee0fb7 [MIPS][microMIPS] Fix PseudoMTLOHI_MM matching and expansion
On micromips MipsMTLOHI is always matched to PseudoMTLOHI_DSP regardless
of +dsp argument. This patch checks is HasDSP predicate is present for
PseudoMTLOHI_DSP so PseudoMTLOHI_MM can be matched when appropriate.

Add expansion of PseudoMTLOHI_MM instruction into a mtlo/mthi pair.

Patch by Mirko Brkusanin.

Differential Revision: http://reviews.llvm.org/D59203

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356039 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 11:04:38 +00:00
Simon Atanasyan
2f4a0fcb84 [mips] Fix CPU used in the test case to suppress warning. NFC
The MSA ASE used in in the test case requires MIPS32 revision 5 or
greater while the test uses MIPS32 revision 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356038 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-13 11:04:28 +00:00
Petar Jovanovic
16c00e17ef [MIPS][microMIPS] Add a pattern to match TruncIntFP
A pattern needed to match TruncIntFP was missing. This was causing multiple
tests from llvm test suite to fail during compilation for micromips.

Patch by Mirko Brkusanin.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355825 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 14:13:31 +00:00
Petar Avramovic
e7f4ae297e [MIPS GlobalISel] NarrowScalar G_UMULH
NarrowScalar G_UMULH in LegalizerHelper 
using multiplyRegisters helper function.
NarrowScalar G_UMULH for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355815 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 10:08:44 +00:00
Petar Avramovic
4306b0ed95 [MIPS GlobalISel] NarrowScalar G_MUL
Narrow Scalar G_MUL for MIPS32.
Revisit NarrowScalar implementation in LegalizerHelper.
Introduce new helper function multiplyRegisters.
It performs generic multiplication of values held in multiple registers.
Generated instructions use only types NarrowTy and i1.
Destination can be same or two times size of the source.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355814 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 10:00:17 +00:00
Petar Avramovic
deb1a9834b [MIPS GlobalISel] Fix mul operands
Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355594 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-07 13:28:29 +00:00
Simon Atanasyan
6f6ca7612e [mips] Replace assertion by error message while lowering RETURNADDR and FRAMEADDR
MIPS target supports lowering `RETURNADDR` and `FRAMEADDR` for a current
frame only. It's better to show an error message then crash on assertion
if `__builtin_return_address` is invoked with non-zero argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355558 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-06 22:40:28 +00:00
Vlad Tsyrklevich
31ec6de6ca Revert "[MIPS GlobalISel] Fix mul operands"
This reverts commit r355178, it is causing ASan failures on the
sanitizer bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355219 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 18:58:22 +00:00
Petar Avramovic
d366a104c4 [MIPS GlobalISel] Fix mul operands
Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355178 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 07:35:57 +00:00
Petar Avramovic
778b40dc9a [MIPS GlobalISel] Select G_UMULH
Legalize G_UMULO and select G_UMULH for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 07:25:44 +00:00
Petar Avramovic
7e18e3836e [MIPS GlobalISel] Select G_UADDO
Lower G_UADDO.
Legalize G_UADDO for MIPS32

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354900 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 17:22:42 +00:00
Simon Atanasyan
501f8883f4 [mips] Emit .module softfloat directive
This change fixes crash on an assertion in case of using
`soft float` ABI for mips32r6 target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 14:45:17 +00:00
Nikita Popov
ecd4bf3b88 [Mips] Fix missing masking in fast-isel of br (PR40325)
Fixes https://bugs.llvm.org/show_bug.cgi?id=40325 by zero extending
(and x, 1) the condition before branching on it.

To avoid regressing trivial cases, I'm combining emission of cmp+br
sequences for the single-use + same block case (similar to what we
do in x86). icmpbr1.ll still regresses due to the cross-bb usage
of the condition.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354808 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 18:54:17 +00:00
Simon Dardis
713bb48902 [MIPS] Fix a incorrect test. (NFC)
This test is incorrect as it should be using the microMIPSR6 instruction to
return, not the microMIPS version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354726 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-23 15:56:32 +00:00
Petar Jovanovic
73763b4d35 [mips][micromips] fix filling delay slots for PseudoIndirectBranch_MM
Filling a delay slot in 32bit jump instructions with a 16bit instruction
can cause issues. According to the documentation such an operation is
unpredictable.
This patch adds opcode Mips::PseudoIndirectBranch_MM alongside
Mips::PseudoIndirectBranch and other instructions that are expanded to jr
instruction and do not allow a 16bit instruction in their delay slots.

Patch by Mirko Brkusanin.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354672 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-22 14:53:58 +00:00
Petar Avramovic
6d2316158f [MIPS MSA] Avoid some DAG combines for vector shifts
DAG combiner combines two shifts into shift + and with bitmask.
Avoid such combines for vectors since leaving two vector shifts
as they are produces better end results.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354461 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 13:42:44 +00:00
Petar Avramovic
f7f662eb99 [MIPS MSA] Add test for vector shift combines
Add test for vector shift combines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354455 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 12:13:11 +00:00
Petar Avramovic
3cb9895a5c [MIPS GlobalISel] Select phi instruction for integers
Select G_PHI for integers for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354025 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 12:36:19 +00:00
Petar Avramovic
e817e7373a [MIPS GlobalISel] Select branch instructions
Select G_BR and G_BRCOND for MIPS32.
Unconditional branch G_BR does not have register operand,
for that reason we only add tests.
Since conditional branch G_BRCOND compares register to zero on MIPS32,
explicit extension must be performed on i1 condition in order to set
high bits to appropriate value.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354022 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 11:39:53 +00:00
Petar Avramovic
005af434d1 [MIPS GlobalISel] Select any extending load and truncating store
Make behavior of G_LOAD in widenScalar same as for G_ZEXTLOAD and
G_SEXTLOAD. That is perform widenScalarDst to size given by the target
and avoid additional checks in common code. Targets can reorder or add
additional rules in LegalizeRuleSet for the opcode to achieve desired
behavior.

Select extending load that does not have specified type of extension
into zero extending load.

Select truncating store that stores number of bytes indicated by size
in MachineMemoperand.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353520 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 14:27:23 +00:00
Petar Avramovic
5cf50dec64 [MIPS GlobalISel] Select mul
Legalize and select G_MUL for s32 and smaller types for MIPS32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353506 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 10:11:33 +00:00
Petar Jovanovic
4245638a61 [mips][micromips] Fix how values in .gcc_except_table are calculated
When a landing pad is calculated in a program that is compiled for micromips
with -fPIC flag, it will point to an even address.
Such an error will cause a segmentation fault, as the instructions in
micromips are aligned on odd addresses. This patch sets the last bit of the
offset where a landing pad is, to 1, which will effectively be an odd
address and point to the instruction exactly.

r344591 fixed this issue for -static compilation.

Patch by Aleksandar Beserminji.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353480 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07 22:57:33 +00:00
Matt Arsenault
31a756d96b GlobalISel: Fix creating MMOs with align 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352712 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 01:38:47 +00:00
Matt Arsenault
714cc866c2 MIR: Reject non-power-of-4 alignments in MMO parsing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352686 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 23:09:28 +00:00
Aleksandar Beserminji
9d102ebca5 [mips] Support for +abs2008 attribute
Instruction abs.[ds] is not generating correct result when working
with NaNs for revisions prior mips32r6 and mips64r6.

To generate a sequence which always produce a correct result, but also
to allow user more control on how his code is compiled, attribute
+abs2008 is added, so user can choose legacy or 2008.

By default legacy mode is used on revisions prior R6. Mips32r6 and
mips64r6 use abs2008 mode by default.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352370 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 14:59:30 +00:00
Petar Avramovic
2ac1bfd366 [MIPS GlobalISel] Select sub
Lower G_USUBO and G_USUBE. Add narrowScalar for G_SUB.
Legalize and select G_SUB for MIPS 32.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352351 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 12:10:17 +00:00
Petar Avramovic
8993a7805d [MIPS GlobalISel] Select zero extending and sign extending load
Select zero extending and sign extending load for MIPS32.
Use size from MachineMemOperand to determine number of bytes to load.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352038 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 10:27:21 +00:00
Petar Avramovic
b404df708c [MIPS GlobalISel] Combine extending loads
Use CombinerHelper to combine extending load instructions.
G_LOAD combined with G_ZEXT, G_SEXT or G_ANYEXT gives G_ZEXTLOAD,
G_SEXTLOAD or G_LOAD with same type as def of extending instruction
respectively.
Similarly G_ZEXTLOAD combined with G_ZEXT gives G_ZEXTLOAD and
G_SEXTLOAD combined with G_SEXT gives G_SEXTLOAD with same type
as def of extending instruction.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352037 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 10:09:52 +00:00