Commit Graph

12265 Commits

Author SHA1 Message Date
Cong Hou
76481a8326 [X86] A small fix in X86/X86TargetTransformInfo.cpp: check a value type is simple before calling getSimpleVT().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251538 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 18:15:46 +00:00
Benjamin Kramer
52482cc241 Put global classes into the appropriate namespace.
Most of the cases belong into an anonymous namespace. No
functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251515 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 13:54:36 +00:00
Craig Topper
e123ed6587 [X86] Make some for loops over MVTs more explicit (and shorter) by just mentioning all the relevant types in an initializer list. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 05:48:32 +00:00
Craig Topper
81bbfcf379 Use range-based for loops and use initializer list to remove a small static array. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251494 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 04:53:27 +00:00
Craig Topper
1d1d5f6090 Remove templates from CostTableLookup functions. All instantiations had the same type.
This also lets us remove the versions of the functions that took a statically sized array as we can rely on ArrayRef implicit conversion now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251490 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 04:02:12 +00:00
Asaf Badouh
cc4e8d7e1d [X86][AVX512] [X86][AVX512] add convert float to half
convert float to half with mask/maskz for the reg to reg version and mask for the reg to mem version (there is no maskz version for reg to mem).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 15:37:17 +00:00
Michael Kuperstein
684557ee8c [X86] Make elfiamcu an OS, not an environment.
GNU tools require elfiamcu to take up the entire OS field, so, e.g.
i?86-*-linux-elfiamcu is not considered a legal triple.
Make us compatible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 07:23:59 +00:00
Craig Topper
156f73362e Convert cost table lookup functions to return a pointer to the entry or nullptr instead of the index.
This avoid mentioning the table name an extra time and allows the lookup to be done directly in the ifs by relying on the bool conversion of the pointer.

While there make use of ArrayRef and std::find_if.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251382 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 04:14:24 +00:00
Sanjay Patel
9b01577169 [x86] replace integer logic ops with packed SSE FP logic ops
If we have an operand to a bitwise logic op that's already in
an XMM register and the result is going to be sent to an XMM
register, then use an SSE logic op to avoid moves between the
integer and vector register files.

Related commits:
http://reviews.llvm.org/rL248395
http://reviews.llvm.org/rL248399
http://reviews.llvm.org/rL248404
http://reviews.llvm.org/rL248409
http://reviews.llvm.org/rL248415

This should solve PR22428:
https://llvm.org/bugs/show_bug.cgi?id=22428



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 01:28:07 +00:00
Sanjay Patel
3fdc848a44 reorganize logic; NFCI (retry r251349)
This is a preliminary step before adding another optimization
to PerformBITCASTCombine().

..and I really hope it's NFC this time!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 21:54:14 +00:00
Sanjay Patel
e7fce43196 revert r251349; it included code for a functional change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 21:28:02 +00:00
Sanjay Patel
4414354c54 reorganize logic; NFCI
This is a preliminary step before adding another optimization
to PerformBITCASTCombine().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 21:24:09 +00:00
Evgeniy Stepanov
324bf0ddcc [safestack] Fast access to the unsafe stack pointer on AArch64/Android.
Android libc provides a fixed TLS slot for the unsafe stack pointer,
and this change implements direct access to that slot on AArch64 via
__builtin_thread_pointer() + offset.

This change also moves more code into TargetLowering and its
target-specific subclasses to get rid of target-specific codegen
in SafeStackPass.

This change does not touch the ARM backend because ARM lowers
builting_thread_pointer as aeabi_read_tp, which is not available
on Android.

The previous iteration of this change was reverted in r250461. This
version leaves the generic, compiler-rt based implementation in
SafeStack.cpp instead of moving it to TargetLoweringBase in order to
allow testing without a TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 18:28:25 +00:00
Igor Breger
e9ad33d22d AVX512: Enabled VPBROADCASTB lowering for v64i8 vectors.
Differential Revision: http://reviews.llvm.org/D13896

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 13:01:02 +00:00
Igor Breger
40b928c9fe AVX-512: Use correct extract vector length.
Bug https://llvm.org/bugs/show_bug.cgi?id=25318

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 12:26:34 +00:00
Igor Breger
31a3f5f4a1 AVX512: Add AVX-512 not materializable instructions.
Otherwise value can be reused , despite its value could be changed - produces incorrect assembler.

https://llvm.org/bugs/show_bug.cgi?id=25270

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 08:37:12 +00:00
David Majnemer
7e2b51ddb0 [MC] Don't crash when .word is given bogus values
We didn't validate that the .word directive was given a sane value,
leading to crashes when we attempt to write out the object file.

Instead, perform some validation and issue a diagnostic pointing at the
start of the diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 02:45:50 +00:00
Benjamin Kramer
165b4f4e46 Convert assert(false) into llvm_unreachable where it makes sense.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251266 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 22:28:27 +00:00
Simon Pilgrim
49cf761925 [X86][SSE4A] Fix for EXTRQI shuffle lowering.
Incorrect range test - found during fuzz testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 17:40:54 +00:00
Elena Demikhovsky
16ed8780c7 Scalarizer for masked.gather and masked.scatter intrinsics.
When the target does not support these intrinsics they should be converted to a chain of scalar load or store operations.
If the mask is not constant, the scalarizer will build a chain of conditional basic blocks.
I added isLegalMaskedGather() isLegalMaskedScatter() APIs.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251237 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 15:37:55 +00:00
Michael Kuperstein
8052f4541d [X86] Use correct calling convention for MCU psABI libcalls
When using the MCU psABI, compiler-generated library calls should pass
some parameters in-register. However, since inreg marking for x86 is currently
done by the front end, it will not be applied to backend-generated calls.

This is a workaround for PR3997, which describes a similar issue for -mregparm.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251223 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 08:14:05 +00:00
Michael Kuperstein
c50c6907aa [X86] Add support for elfiamcu triple
This adds support for the i?86-*-elfiamcu triple, which indicates the IAMCU psABI is used.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 08:07:37 +00:00
Craig Topper
30a1e5aa96 Remove two unnecessary conversions from MVT to EVT. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 03:15:29 +00:00
Simon Pilgrim
878eaf48c1 [X86][SSE] Use lowerVectorShuffleWithUNPCK instead of custom matches.
Most 128-bit and 256-bit shuffles were manually matching UNPCK patterns - use lowerVectorShuffleWithUNPCK to be more thorough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251211 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 22:45:04 +00:00
Simon Pilgrim
f811b16da3 [X86][SSE] lowerVectorShuffleWithUNPCK - use equivalent shuffle mask test.
Use isShuffleEquivalent to match UNPCK shuffles - better support for build vector inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 20:48:08 +00:00
Hans Wennborg
76da85d572 X86ISelLowering: Support tail calls to/from callee pop functions
This enables tail calls with thiscall, stdcall, vectorcall and
fastcall functions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 16:47:10 +00:00
Simon Pilgrim
3f3f65ad5f Fix unused variable warning. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 13:41:45 +00:00
Simon Pilgrim
d0ca754540 [X86][XOP] Add support for lowering vector rotations
This patch adds support for lowering to the XOP VPROT / VPROTI vector bit rotation instructions.

This has required changes to the DAGCombiner rotation pattern matching to support vector types - so far I've only changed it to support splat vectors, but generalising this further is feasible in the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251188 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 13:17:26 +00:00
Reid Kleckner
34f572a0d2 [X86] Clean up the tail call eligibility logic
Summary:
The logic here isn't straightforward because our support for
TargetOptions::GuaranteedTailCallOpt.

Also fix a bug where we were allowing tail calls to cdecl functions from
fastcall and vectorcall functions. We were special casing thiscall and
stdcall callers rather than checking for any convention that requires
clearing stack arguments before returning.

Reviewers: hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 19:35:38 +00:00
Joseph Tremoulet
53fbda20e9 [CodeGen] Mark setjmp/catchret MBBs address-taken
Summary:
This ensures that BranchFolding (and similar) won't remove these blocks.

Also allow AsmPrinter::EmitBasicBlockStart to process MBBs which are
address-taken but do not have BBs that are address-taken, since otherwise
its call to getAddrLabelSymbolTableToEmit would fail an assertion on such
blocks.  I audited the other callers of getAddrLabelSymbolTableToEmit
(and getAddrLabelSymbol); they all have BBs known to be address-taken
except for the call through getAddrLabelSymbol from
WinException::create32bitRef; that call is actually now unreachable, so
I've removed it and updated the signature of create32bitRef.

This fixes PR25168.

Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: pgavlin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251113 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 15:06:05 +00:00
Eric Christopher
8df359534b Remove the last traces of X86CompilationCallback as it is completely
unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 17:55:35 +00:00
Asaf Badouh
4673f9ea5e [X86][AVX512] extend vcvtph2ps to support xmm/ymm and sae versions
Differential Revision: http://reviews.llvm.org/D13945


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251018 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 14:01:16 +00:00
Elena Demikhovsky
26658aadc6 AVX-512: Fixed a bug in select_cc for i1 type
Fixed faiure:
LLVM ERROR: Cannot select: t33: i1 = select_cc t25, Constant:i32<0>, t45, t42, seteq:ch

added a test

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 07:10:29 +00:00
Elena Demikhovsky
98f84ad174 Partially reverted changes from r250686
Clang runtime failure was reported.
   Assertion failed: (isExtended() && "Type is not extended!"), function getTypeForEVT
I'll need to add a proper handling for PointerType in masked load/store intrinsics.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 06:20:29 +00:00
Sanjay Patel
e2266e94c8 [x86] move recursive add match for LEA to helper function; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 18:56:06 +00:00
Craig Topper
8b64b61d9a [X86] Add AMD mwaitx, monitorx, and clzero instructions to the assembly parser and disassembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 17:26:45 +00:00
Mehdi Amini
d63954dac1 Do not use dyn_cast<X> after isa<X> (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250883 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 06:11:01 +00:00
Igor Breger
7bbbc5ccde AVX512: Implemented encoding and intrinsics for VPBROADCASTB/W/D/Q instructions.
Differential Revision: http://reviews.llvm.org/D13884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250819 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 11:56:42 +00:00
Duncan P. N. Exon Smith
d765f759fa X86: Remove implicit ilist iterator conversions, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250741 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 21:48:29 +00:00
Benjamin Kramer
fa39e176c7 Remove CRLF newlines. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 13:05:25 +00:00
Elena Demikhovsky
da40167c02 Removed parameter "Consecutive" from isLegalMaskedLoad() / isLegalMaskedStore().
Originally I planned to use the same interface for masked gather/scatter and set isConsecutive to "false" in this case.

Now I'm implementing masked gather/scatter and see that the interface is inconvenient. I want to add interfaces isLegalMaskedGather() / isLegalMaskedScatter() instead of using the "Consecutive" parameter in the existing interfaces.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250686 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 07:43:38 +00:00
Asaf Badouh
c375284b82 [X86][AVX512DQ] add scalar fpclass
Differential Revision: http://reviews.llvm.org/D13769


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250650 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-18 11:04:38 +00:00
Igor Breger
38e1c0e55a AVX512: Lowering i8/i16 vector CTLZ using the dword LZCNT vector instruction
Differential Revision: http://reviews.llvm.org/D13632

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-18 09:56:39 +00:00
Simon Pilgrim
3795ae0b61 [X86][XOP] Add VPROT instruction opcodes
Added X86ISD opcodes for VPROT vector rotate by variable and by immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250620 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 19:04:24 +00:00
Craig Topper
43a9e4096c Replace a custom table sort check with std::is_sorted. Change a function to take ArrayRef instead of pointer and length. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250615 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 16:37:13 +00:00
Simon Pilgrim
913c649b16 [CostModel] Fixed AVX integer shift costs
Targets with AVX but without AVX2 were incorrectly reporting costs of 256-bit integer shifts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 13:23:38 +00:00
Simon Pilgrim
1157bfddb9 [X86][FastISel] Teach how to select SSE4A nontemporal stores.
Add FastISel support for SSE4A scalar float / double non-temporal stores

Follow up to D13698

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250610 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 13:04:42 +00:00
Reid Kleckner
610dd981a3 [WinEH] Fix stack alignment in funclets and ParentFrameOffset calculation
Our previous value of "16 + 8 + MaxCallFrameSize" for ParentFrameOffset
is incorrect when CSRs are involved. We were supposed to have a test
case to catch this, but it wasn't very rigorous.

The main effect here is that calling _CxxThrowException inside a
catchpad doesn't immediately crash on MOVAPS when you have an odd number
of CSRs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:43:27 +00:00
Sanjay Patel
d6d66ea302 [x86] promote 'add nsw' to a wider type to allow more combines
The motivation for this patch starts with PR20134:
https://llvm.org/bugs/show_bug.cgi?id=20134

void foo(int *a, int i) {
  a[i] = a[i+1] + a[i+2];
}

It seems better to produce this (14 bytes):

movslq	%esi, %rsi
movl	0x4(%rdi,%rsi,4), %eax
addl	0x8(%rdi,%rsi,4), %eax
movl	%eax, (%rdi,%rsi,4)

Rather than this (22 bytes):

leal	0x1(%rsi), %eax
cltq             
leal	0x2(%rsi), %ecx      
movslq	%ecx, %rcx     
movl	(%rdi,%rcx,4), %ecx
addl	(%rdi,%rax,4), %ecx
movslq	%esi, %rax       
movl	%ecx, (%rdi,%rax,4)

The most basic problem (the first test case in the patch combines constants) should also be fixed in InstCombine, 
but it gets more complicated after that because we need to consider architecture and micro-architecture. For
example, AArch64 may not see any benefit from the more general transform because the ISA solves the sexting in
hardware. Some x86 chips may not want to replace 2 ADD insts with 1 LEA, and there's an attribute for that: 
FeatureSlowLEA. But I suspect that doesn't go far enough or maybe it's not getting used when it should; I'm 
also not sure if FeatureSlowLEA should also mean "slow complex addressing mode".

I see no perf differences on test-suite with this change running on AMD Jaguar, but I see small code size
improvements when building clang and the LLVM tools with the patched compiler.

A more general solution to the sext(add nsw(x, C)) problem that works for multiple targets is available
in CodeGenPrepare, but it may take quite a bit more work to get that to fire on all of the test cases that
this patch takes care of.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250560 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 22:14:12 +00:00
Andrew Kaylor
bde51df753 Fix assertion failure with fp128 to unsigned i64 conversion
Patch by Mitch Bodart

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 20:39:20 +00:00