Commit Graph

24648 Commits

Author SHA1 Message Date
Jonas Paulsson ea7c1d4e4e [SystemZ] Bugfix of CC liveness in emitMemMemWrapper (CLC).
If DoneMBB becomes empty it must have CC added to its live-in list, since it
will fall-through into EndMBB. This happens when the CLC loop does the
complete range.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-19 13:05:22 +00:00
Alex Bradbury abb819e1e5 [RISCV] Peephole optimisation for load/store of global values or constant addresses
(load (add base, off), 0) -> (load base, off)
(store val, (add base, off)) -> (store val, base, off)

This is similar to an equivalent peephole optimisation in PPCISelDAGToDAG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327831 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-19 11:54:28 +00:00
Craig Topper c479e3d3f2 [X86] Add ADD16i16/ADD32i32/ADD64i32 and similar to the scheduler models to match ADD8i8.
Also move ADC8i8 and SBB8i8 in the Sandy Bridge model to the same class as ADC8ri and SBB8ri. That seems more accurate since its the 8i8 is just the register forced to AL instead of coming from modrm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327820 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-19 04:21:40 +00:00
Dylan McKay f0c8edc1fc [AVR] Lower i128 divisions to runtime library calls
This patch adds i128 division support by instruction LLVM to lower
128-bit divisions to the __udivmodti4 and __divmodti4 rtlib functions.

This also adds test for 64-bit division and 128-bit division.

Patch by Peter Nimmervoll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327814 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-19 00:55:50 +00:00
Simon Pilgrim 03fbd137fa [X86][Btver2] Fix crc32 schedule costs
The default is currently FAdd for some reason

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327807 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-18 19:54:42 +00:00
Craig Topper 270a3a483f [X86] Fix a bunch of overlapping regular expressions in the scheduler models.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327787 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-18 08:38:06 +00:00
Craig Topper 8b968a4e3c [X86] Remove MMX_MASKMOVQ64 and VMASKMOVDQU from scheduler models.
The information was so wildly inaccurate and incomplete its better to just remove it.

MMX_MASKMOVQ64 showed up twice in several scheduler models. In Haswell and Broadwell they were on adjacent lines. On Skylake the copies had different information.

MMX_MASKMOVQ and MASKMOVDQU were completely missing.

MMX_MASKMOVQ64 was listed on Haswell/Broadwell as 1 cycle on port 1 despite it being a store instruction.

Filed PR36780 to track fixing this right.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327783 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-18 03:24:42 +00:00
Nirav Dave f35e82f91d Revert "[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172""
as it times out building test-suite on PPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327778 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 19:24:54 +00:00
Nirav Dave f79c73681d [DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"
Reland ISel cycle checking improvements after simplifying and reducing
node id invariant traversal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327777 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 17:42:10 +00:00
Matt Arsenault 65181f7b75 AMDGPU/GlobalISel: Cleanup constant legality
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327774 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 15:17:48 +00:00
Matt Arsenault 417485b734 AMDGPU/GlobalISel: Basic G_GEP legality
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327773 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 15:17:45 +00:00
Matt Arsenault 177d1142dd AMDGPU/GlobalISel: Basic legality for load/store
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327772 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 15:17:41 +00:00
Oren Ben Simhon 10c992c085 [X86] Added support for nocf_check attribute for indirect Branch Tracking
X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow Enforcement Technology (CET).
IBT instruments ENDBR instructions used to specify valid targets of indirect call / jmp.
The `nocf_check` attribute has two roles in the context of X86 IBT technology:
	1. Appertains to a function - do not add ENDBR instruction at the beginning of the function.
	2. Appertains to a function pointer - do not track the target function of this pointer by adding nocf_check prefix to the indirect-call instruction.

This patch implements `nocf_check` context for Indirect Branch Tracking.
It also auto generates `nocf_check` prefixes before indirect branchs to jump tables that are guarded by range checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 13:29:46 +00:00
Jonas Paulsson 0c44305d76 [SystemZ] Add 'REQUIRES: asserts' to test case using debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 09:15:13 +00:00
Jonas Paulsson 42bc90e172 [SystemZ] computeKnownBitsForTargetNode() / ComputeNumSignBitsForTargetNode()
Improve/implement these methods to improve DAG combining. This mainly
concerns intrinsics.

Some constant operands to SystemZISD nodes have been marked Opaque to avoid
transforming back and forth between generic and target nodes infinitely.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327765 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 08:32:12 +00:00
Jonas Paulsson eb9d4e05e6 [SelectionDAG] Handle big endian target BITCAST in computeKnownBits()
The BITCAST handling in computeKnownBits() previously only worked for little
endian.

This patch reverses the iteration over elements for a big endian target which
allows this to work in this case also.

SystemZ test case.

Review: Eli Friedman
https://reviews.llvm.org/D44249

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 08:04:00 +00:00
Jessica Paquette af5b99318d [MachineOutliner] Make KILLs invisible
At the point the outliner runs, KILLs don't impact anything, but they're still
considered unique instructions. This commit makes them invisible like
DebugValues so that they can still be outlined without impacting outlining
decisions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 22:53:34 +00:00
Krzysztof Parzyszek 62100bd95a [Hexagon] Avoid bank conflicts in post-RA scheduler
Avoid scheduling two loads in such a way that they would end up in the
same packet. If there is a load in a packet, try to schedule a non-load
next.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327742 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 20:55:49 +00:00
Krzysztof Parzyszek 962b1b6c19 [Hexagon] Add lit testcases for atomic intrinsics
Patch by Ben Craig.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327737 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 20:21:43 +00:00
Reid Kleckner 025ee4f9cc [IR] Avoid the need to prefix MS C++ symbols with '\01'
Now the Windows mangling modes ('w' and 'x') do not do any mangling for
symbols starting with '?'. This means that clang can stop adding the
hideous '\01' leading escape. This means LLVM debug logs are less likely
to contain ASCII escape characters and it will be easier to copy and
paste MS symbol names from IR.

Finally.

For non-Windows platforms, names starting with '?' still get IR
mangling, so once clang stops escaping MS C++ names, we will get extra
'_' prefixing on MachO. That's fine, since it is currently impossible to
construct a triple that uses the MS C++ ABI in clang and emits macho
object files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327734 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 20:13:32 +00:00
Farhana Aleen 7c98e88dc9 [AMDGPU] Supported ds_write_b128 generation.
Summary: This is a follow-on patch of https://reviews.llvm.org/D44210

Author: FarhanaAleen

Reviewed By: msearles

Subscribers: llvm-commits, AMDGPU

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327726 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 18:12:00 +00:00
Craig Topper c1b9fa26d9 [X86] Post process the DAG after isel to remove vector moves that were added to zero upper bits.
We previously avoided inserting these moves during isel in a few cases which is implemented using a whitelist of opcodes. But it's too difficult to generate a perfect list of opcodes to whitelist. Especially with AVX512F without AVX512VL using 512 bit vectors to implement some 128/256 bit operations. Since isel is done bottoms up, we'd have to check the VT and opcode and subtarget in order to determine whether an EXTRACT_SUBREG would be generated for some operations.

So instead of doing that, this patch adds a post processing step that detects when the moves are unnecesssary after isel. At that point any EXTRACT_SUBREGs would have already been created and appear in the DAG. So then we just need to ensure the input to the move isn't one.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327724 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 17:13:42 +00:00
Dmitry Preobrazhensky a5e8c708f7 [AMDGPU][MC][GFX8][GFX9][DISASSEMBLER] Added "_e32" suffix to 32-bit VINTRP opcodes
See bug 36751: https://bugs.llvm.org/show_bug.cgi?id=36751

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

Reviewers: artem.tamazov, arsenm

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327723 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 16:38:04 +00:00
Krzysztof Parzyszek 4dee549834 [Hexagon] Fix zero-extending non-HVX bool vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327712 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 15:03:37 +00:00
Simon Pilgrim 9d52551911 [X86][Btver2] Add correct mul/imul schedule costs
Integer multiply is performed on the JMul function unit and i64 requires double pumping

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327707 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 14:01:01 +00:00
Simon Pilgrim d957afd022 [X86][Btver2] Add correct lzcnt/tzcnt/popcnt schedule costs
Don't use WriteIMul defaults

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327706 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 13:43:55 +00:00
Sjoerd Meijer 547e2f8dcc [ARM] FP16 codegen support for VSEL
This implements lowering of SELECT_CC for f16s, which enables
codegen of VSEL with f16 types.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327695 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 08:06:25 +00:00
Craig Topper fdfe3c24c8 [SelectionDAG][ARM][X86] Teach PromoteIntRes_SETCC to do a better job picking the result type for the setcc.
Previously if getSetccResultType returned an illegal type we just fell back to using the default promoted type. This appears to have been to handle the case where for vectors getSetccResultType returns the input type, but the input type itself isn't legal and will need to be promoted. Without the legality check we would never reach a legal type.

But just picking the promoted type to be the setcc type can create strange setccs where the result type is 128 bits and the operand type is 256 bits. If for example the result type was promoted to v8i16 from v8i1, but the input type was promoted from v8i23 to v8i32. We currently handle this with custom lowering code in X86.

This legality check also caused us reject the getSetccResultType when the input type needed to be widened or split. Even though that result wouldn't have caused legalization to get stuck.

This patch tries to fix this by detecting the getSetccResultType needs to be promoted. If its input type also needs to be promoted we'll try a ask for a new setcc result type based on its eventual promoted value. Otherwise we fall back to default type to promote to.

For any other illegal values we might get back from the initial call to getSetccResultType we just keep and allow it to be re-legalized later via splitting or widening or scalarizing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327683 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 23:04:11 +00:00
Craig Topper a3e0d356f4 [X86] Make sure we use FSUB instruction as the reference for operand order in isAddSubOrSubAdd when recognizing subadd
The FADD part of the addsub/subadd pattern can have its operands commuted, but when checking for fsubadd we were using the fadd as reference and commuting the fsub node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327660 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 20:30:54 +00:00
Craig Topper f2188eee62 [X86] Add test case showing bad fmsubadd creation due to bad commuting.
The code that creates fmsubadd from shuffle vector has some code to allow commuting the operands of the fadd node. This code was originally created when we only recognized fmaddsub. When fmsubadd support was added this code was not updated and is now commuting the fsub operands instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327659 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 20:30:51 +00:00
Guozhi Wei 03d35ec16a [PPC] Avoid non-simple MVT in STBRX optimization
PR35402 triggered this case. It bswap and stores a 48bit value, current STBRX optimization transforms it into STBRX. Unfortunately 48bit is not a simple MVT, there is no PPC instruction to support it, and it can't be automatically expanded by llvm, so caused a crash.

This patch detects the non-simple MVT and returns early.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327651 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 17:49:12 +00:00
Zaara Syeda ffb3337b41 [PowerPC] Optimize TLS initial-exec sequence to use X-Form loads/stores
This patch adds new load/store instructions for integer scalar types
which can be used for X-Form when fed by add with an @tls relocation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 15:34:41 +00:00
Simon Pilgrim 258a13c8f2 [X86][Btver2] Remove JAny resource, and map system/microcoded instructions to JALU pipes
Simplifies throughput to the issue width (1/2) instead of permitting any pipe (1/6)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327632 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 15:12:12 +00:00
Simon Pilgrim e7dd436d90 [X86][SSE] Introduce Float/Vector WriteMove, WriteLoad and Writetore scheduler classes
As discussed on D44428 and PR36726, this patch splits off WriteFMove/WriteVecMove, WriteFLoad/WriteVecLoad and WriteFStore/WriteVecStore scheduler classes to permit vectors to be handled separately from gpr/scalar types.

I've minimised the diff here by only moving various basic SSE/AVX vector instructions across - we can fix the rest when called for. This does fix the MOVDQA vs MOVAPS/MOVAPD discrepancies mentioned on D44428.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 14:45:30 +00:00
Simon Pilgrim dc55b3ba68 [X86] Regenerate schedule tests with zero latency comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327628 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 14:30:59 +00:00
Sjoerd Meijer 94b082e3cc [AArch64] Codegen tests for the Armv8.2-A FP16 intrinsics
This is a follow up of the AArch64 FP16 intrinsics work;
the codegen tests had not been added yet.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 13:42:28 +00:00
Craig Topper a2e859907e [X86] Add test cases for 512-bit addsub from build_vector.
There is no 512 bit addsub instruction, but we partially match it handle fmaddsub matching. We explicitly bail out for 512 bit vectors after failing the fmaddsub match, but we had no test coverage for that bail out.

We might want to consider splitting and using 256 bit instructions instead of the long sequence seen here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327605 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 06:49:01 +00:00
Craig Topper cc5be0160c [X86] Add support for matching FMSUBADD from build_vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327604 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 06:14:55 +00:00
Mark Searles b30a83dec3 [AMDGPU] Waitcnt pass: Modify the waitcnt pass to propagate info in the case of a single basic block loop. mergeInputScoreBrackets() does this for us; update it so that it processes the single bb's score bracket when processing the single bb's preds. It is, after all, a pred of itself, so it's score bracket is needed.
Differential Revision: https://reviews.llvm.org/D44434

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327583 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 22:04:32 +00:00
Reid Kleckner 4d4a317f80 [FastISel] Sink local value materializations to first use
Summary:
Local values are constants, global addresses, and stack addresses that
can't be folded into the instruction that uses them. For example, when
storing the address of a global variable into memory, we need to
materialize that address into a register.

FastISel doesn't want to materialize any given local value more than
once, so it generates all local value materialization code at
EmitStartPt, which always dominates the current insertion point. This
allows it to maintain a map of local value registers, and it knows that
the local value area will always dominate the current insertion point.

The downside is that local value instructions are always emitted without
a source location. This is done to prevent jumpy line tables, but it
means that the local value area will be considered part of the previous
statement. Consider this C code:
  call1();      // line 1
  ++global;     // line 2
  ++global;     // line 3
  call2(&global, &local); // line 4

Today we end up with assembly and line tables like this:
  .loc 1 1
  callq call1
  leaq global(%rip), %rdi
  leaq local(%rsp), %rsi
  .loc 1 2
  addq $1, global(%rip)
  .loc 1 3
  addq $1, global(%rip)
  .loc 1 4
  callq call2

The LEA instructions in the local value area have no source location and
are treated as being on line 1. Stepping through the code in a debugger
and correlating it with the assembly won't make much sense, because
these materializations are only required for line 4.

This is actually problematic for the VS debugger "set next statement"
feature, which effectively assumes that there are no registers live
across statement boundaries. By sinking the local value code into the
statement and fixing up the source location, we can make that feature
work. This was filed as https://bugs.llvm.org/show_bug.cgi?id=35975 and
https://crbug.com/793819.

This change is obviously not enough to make this feature work reliably
in all cases, but I felt that it was worth doing anyway because it
usually generates smaller, more comprehensible -O0 code. I measured a
0.12% regression in code generation time with LLC on the sqlite3
amalgamation, so I think this is worth doing.

There are some special cases worth calling out in the commit message:
1. local values materialized for phis
2. local values used by no-op casts
3. dead local value code

Local values can be materialized for phis, and this does not show up as
a vreg use in MachineRegisterInfo. In this case, if there are no other
uses, this patch sinks the value to the first terminator, EH label, or
the end of the BB if nothing else exists.

Local values may also be used by no-op casts, which adds the register to
the RegFixups table. Without reversing the RegFixups map direction, we
don't have enough information to sink these instructions.

Lastly, if the local value register has no other uses, we can delete it.
This comes up when fastisel tries two instruction selection approaches
and the first materializes the value but fails and the second succeeds
without using the local value.

Reviewers: aprantl, dblaikie, qcolombet, MatzeB, vsk, echristo

Subscribers: dotdash, chandlerc, hans, sdardis, amccarth, javed.absar, zturner, llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327581 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 21:54:21 +00:00
Francis Visoiu Mistrih 0d758f3663 [CodeGen] Use MIR syntax for MachineMemOperand printing
Get rid of the "; mem:" suffix and use the one we use in MIR: ":: (load 2)".

rdar://38163529

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 21:52:13 +00:00
Simon Pilgrim 8f10645fe1 [X86] Add haswell testing for PR35635 as well.
To improve complete model testing for schedulers for instructions with multiple results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327572 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 21:03:09 +00:00
Francis Visoiu Mistrih d31cc5d410 [AArch64] Emit CSR loads in the same order as stores
Optionally allow the order of restoring the callee-saved registers in the
epilogue to be reversed.

The flag -reverse-csr-restore-seq generates the following code:

```
stp     x26, x25, [sp, #-64]!
stp     x24, x23, [sp, #16]
stp     x22, x21, [sp, #32]
stp     x20, x19, [sp, #48]

; [..]

ldp     x24, x23, [sp, #16]
ldp     x22, x21, [sp, #32]
ldp     x20, x19, [sp, #48]
ldp     x26, x25, [sp], #64
ret
```

Note how the CSRs are restored in the same order as they are saved.

One exception to this rule is the last `ldp`, which allows us to merge
the stack adjustment and the ldp into a post-index ldp. This is done by
first generating:

ldp x26, x27, [sp]
add sp, sp, #64

which gets merged by the arm64 load store optimizer into

ldp x26, x25, [sp], #64

The flag is disabled by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327569 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 20:34:03 +00:00
Craig Topper 2671f80b2d [X86] Add back fast-isel code for handling i8 shifts.
I removed this in r316797 because the coverage report showed no coverage and I thought it should have been handled by the auto generated table. I now see that there is code that bypasses the table if the shift amount is out of bounds.

This adds back the code. We'll codegen out of bounds i8 shifts to effectively (amount & 0x1f). The 0x1f is a strange quirk of x86 that shift amounts are always masked to 5-bits(except 64-bits). So if the masked value is still out bounds the result will be 0.

Fixes PR36731.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327540 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 17:57:19 +00:00
Francis Visoiu Mistrih b34a8c964f [AArch64] Keep track of MIFlags in the LoadStoreOptimizer
Merging:

* $x26, $x25 = frame-setup LDPXi $sp, 0
* $sp = frame-destroy ADDXri $sp, 64, 0

into an LDPXpost should preserve the flags from both instructions as
following:

* frame-setup frame-destroy LDPXpost

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327533 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 17:10:58 +00:00
Craig Topper 3a48b7c274 [X86] Teach X86TargetLowering::targetShrinkDemandedConstant to set non-demanded bits if it helps created an and mask that can be matched as a zero extend.
I had to modify the bswap recognition to allow unshrunk masks to make this work.

Fixes PR36689.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 16:55:15 +00:00
Simon Pilgrim d1498c372a [X86][AVX] Use WriteFShuffleLd for broadcast reg-mem instructions
They shouldn't be treated as pure loads.

Found while investigating D44428

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327524 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 15:47:08 +00:00
Arnold Schwaighofer 1fd0177abc SjLjEHPrepare: Don't reg-to-mem swifterror values
swifterror llvm values model the swifterror register as memory at the
LLVM IR level. ISel will perform adhoc mem-to-reg on them. swifterror
values are constraint in how they can be used. Spilling them to memory
is not allowed.

SjLjEHPrepare tried to lower swifterror values to memory which is
unecessary since the back-end will spill and reload the register as
neccessary (as long as clobbering calls are marked as such which is the
case here) and further leads to invalid IR because swifterror values
can't be stored to memory.

rdar://38164004

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327521 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 15:44:07 +00:00
Alexander Ivchenko 47473109e3 [GlobalIsel][X86] Support for G_SDIV instruction
Reviewed By: igorb

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327520 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 15:41:11 +00:00
Simon Pilgrim c2b0f90df1 [X86][Btver2] Fix YMM shuffle, permute and permutevar scheduler costs
Account for ymm double pumping and add proper pshufb/permutevar support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327510 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 14:05:19 +00:00