Chandler Carruth [Thu, 25 Sep 2014 00:24:19 +0000 (00:24 +0000)]
[x86] Implement v16i16 support with AVX2 in the new vector shuffle
lowering.
This also implements the fancy blend lowering for v16i16 using AVX2 and
teaches the X86 backend to print shuffle masks for 256-bit PSHUFB
and PBLENDW instructions. It also makes the mask decoding correct for
PBLENDW instructions. The yaks, they are legion.
Tests are updated accordingly. There are some missing tests for the
VBLENDVB lowering, but I'll add those in a follow-up as this commit has
accumulated enough cruft already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218430
91177308-0d34-0410-b5e6-
96231b3b80d8
Kevin Enderby [Wed, 24 Sep 2014 23:08:22 +0000 (23:08 +0000)]
Flush out enough of llvm-objdump’s SymbolizerSymbolLookUp() for Mach-O files to
get the literal string “Hello world” printed as a comment on the instruction
that loads the pointer to it. For now this is just for x86_64. So for object
files with relocation entries it produces things like:
leaq L_.str(%rip), %rax ## literal pool for: "Hello world\n"
and similar for fully linked images like executables:
leaq 0x4f(%rip), %rax ## literal pool for: "Hello world\n"
Also to allow testing against darwin’s otool(1), I hooked up the existing
-no-show-raw-insn option to the Mach-O parser code, added the new Mach-O
only -full-leading-addr option to match otool(1)'s printing of addresses and
also added the new -print-imm-hex option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218423
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Wed, 24 Sep 2014 22:41:55 +0000 (22:41 +0000)]
[asan] don't instrument module CTORs that may be run before asan.module_ctor. This fixes asan running together -coverage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218421
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:58:04 +0000 (21:58 +0000)]
Removing empty ARM tests from failed revert
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218419
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:45:26 +0000 (21:45 +0000)]
Removing empty tests from failed revert
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218417
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:30:43 +0000 (21:30 +0000)]
Revert 218406 - Refactor the RelocVisitor::visit method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218416
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:30:14 +0000 (21:30 +0000)]
Revert 218407 - Add support for ARM and AArch64 BE object files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218415
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:29:45 +0000 (21:29 +0000)]
Revert 218408 - Report endianness in output of {dwarf, obj}dump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218414
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:28:53 +0000 (21:28 +0000)]
Revert 218411 - XFAIL reloc test on x86/hexagon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218413
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 21:00:30 +0000 (21:00 +0000)]
XFAIL reloc test on x86/hexagon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218411
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Wed, 24 Sep 2014 20:37:14 +0000 (20:37 +0000)]
Revert r218380. This was breaking Apple internal build bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218409
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 20:07:41 +0000 (20:07 +0000)]
Report endianness in output of {dwarf, obj}dump
For biendian targets like ARM and AArch64, it is useful to have the
output of the llvm-dwarfdump and llvm-objdump report the endianness
used when the object files were generated.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218408
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 20:07:30 +0000 (20:07 +0000)]
Add support for ARM and AArch64 BE object files
This change fixes the ARM and AArch64 relocation visitors in
RelocVisitor. They were unconditionally assuming the object data are
little-endian. Tests have been added to ensure that the
llvm-dwarfdump utility does not crash when processing big-endian
object files.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218407
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 20:07:22 +0000 (20:07 +0000)]
Refactor the RelocVisitor::visit method
This change replaces the brittle if/else chain of string comparisons
with a switch statement on the detected target triple, removing the
need for testing arbitrary architecture names returned from
getFileFormatName, whose primary purpose seems to be for display
(user-interface) purposes. The visitor now takes a reference to the
object file, rather than its arbitrary file format name to figure out
whether the file is a 32 or 64-bit object file and what the detected
target triple is.
A set of tests have been added to help show that the refactoring processes
relocations for the same targets as the original code.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218406
91177308-0d34-0410-b5e6-
96231b3b80d8
Scott Douglass [Wed, 24 Sep 2014 18:37:48 +0000 (18:37 +0000)]
pass environment when invoking llvm-config from lit.cfg
Use the same environment when invoking llvm-config from lit.cfg as
will be used when running tests, so that ASAN_OPTIONS, INCLUDE, etc.
are present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218403
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Wed, 24 Sep 2014 18:35:58 +0000 (18:35 +0000)]
Adding #ifdef around TermColorMutex based on feedback from Craig Topper.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218401
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 18:20:09 +0000 (18:20 +0000)]
[x86] Factor out the logic to generically decombose a vector shuffle
into unblended shuffles and a blend.
This is the consistent fallback for the lowering paths that have fast
blend operations available, and its getting quite repetitive.
No functionality changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218399
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Wed, 24 Sep 2014 18:00:20 +0000 (18:00 +0000)]
Revert "Add support for ARM and AArch64 BE object files"
This reverts commit r218389 as it depends on r218388.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218398
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Wed, 24 Sep 2014 18:00:17 +0000 (18:00 +0000)]
Revert "Report endianness in output of {dwarf, obj}dump"
This reverts commit r218391 as it depends on r218388 and r218389
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218397
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Wed, 24 Sep 2014 17:49:07 +0000 (17:49 +0000)]
Revert "Refactor the RelocVisitor::visit method"
This reverts commit
faac033f7364bb4226e22c8079c221c96af10d02.
The test depends on all targets to be enabled in llc in order to pass,
and needs to be rewritten/refactored to not have that dependency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218393
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 17:01:33 +0000 (17:01 +0000)]
Report endianness in output of {dwarf, obj}dump
For biendian targets like ARM and AArch64, it is useful to have the
output of the llvm-dwarfdump and llvm-objdump report the endianness
used when the object files were generated.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218391
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 17:01:06 +0000 (17:01 +0000)]
Add support for ARM and AArch64 BE object files
This change fixes the ARM and AArch64 relocation visitors in
RelocVisitor. They were unconditionally assuming the object data are
little-endian. Tests have been added to ensure that the
llvm-dwarfdump utility does not crash when processing big-endian
object files.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218389
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Wed, 24 Sep 2014 17:00:42 +0000 (17:00 +0000)]
Refactor the RelocVisitor::visit method
This change replaces the brittle if/else chain of string comparisons
with a switch statement on the detected target triple, removing the
need for testing arbitrary architecture names returned from
getFileFormatName, whose primary purpose seems to be for display
(user-interface) purposes. The visitor now takes a reference to the
object file, rather than its arbitrary file format name to figure out
whether the file is a 32 or 64-bit object file and what the detected
target triple is.
A set of tests have been added to help show that the refactoring processes
relocations for the same targets as the original code.
Patch by Charlie Turner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218388
91177308-0d34-0410-b5e6-
96231b3b80d8
David Peixotto [Wed, 24 Sep 2014 16:48:31 +0000 (16:48 +0000)]
Fix assertion in LICM doFinalization()
The doFinalization method checks that the LoopToAliasSetMap is
empty. LICM populates that map as it runs through the loop nest,
deleting the entries for child loops as it goes. However, if a child
loop is deleted by another pass (e.g. unrolling) then the loop will
never be deleted from the map because LICM walks the loop nest to
find entries it can delete.
The fix is to delete the loop from the map and free the alias set
when the loop is deleted from the loop nest.
Differential Revision: http://reviews.llvm.org/D5305
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218387
91177308-0d34-0410-b5e6-
96231b3b80d8
Moritz Roth [Wed, 24 Sep 2014 16:35:50 +0000 (16:35 +0000)]
[Thumb] Make load/store optimizer less conservative.
If it's safe to clobber the condition flags, we can do a few extra things:
it's then possible to reset the base register writeback using a SUBS, so
we can try to merge even if the base register isn't dead after the merged
instruction.
This is effectively a (heavily bug-fixed) rewrite of r208992.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218386
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Wed, 24 Sep 2014 14:20:01 +0000 (14:20 +0000)]
[Thumb] 32-bit encodings of 'cps' are not valid for v7M
v7M only allows the 16-bit encoding of the 'cps' (Change Processor
State) instruction, and does not have the 32-bit encoding which is
valid from v6T2 onwards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218382
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Wed, 24 Sep 2014 13:54:56 +0000 (13:54 +0000)]
Silencing an "enumeral and non-enumeral type in conditional expression" warning. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218381
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 24 Sep 2014 13:19:28 +0000 (13:19 +0000)]
Replace a hand-written suffix compare with std::lexicographical_compare.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218380
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 09:39:41 +0000 (09:39 +0000)]
[x86] Teach the instruction lowering to add comments describing constant
pool data being loaded into a vector register.
The comments take the form of:
# ymm0 = [a,b,c,d,...]
# xmm1 = <x,y,z...>
The []s are used for generic sequential data and the <>s are used for
specifically ConstantVector loads. Undef elements are printed as the
letter 'u', integers in decimal, and floating point values as floating
point values. Suggestions on improving the formatting or other aspects
of the display are very welcome.
My primary use case for this is to be able to FileCheck test masks
passed to vector shuffle instructions in-register. It isn't fantastic
for that (no decoding special zeroing semantics or other tricks), but it
at least puts the mask onto an instruction line that could reasonably be
checked. I've updated many of the new vector shuffle lowering tests to
leverage this in their test cases so that we're actually checking the
shuffle masks remain as expected.
Before implementing this, I tried a *bunch* of different approaches.
I looked into teaching the MCInstLower code to scan up the basic block
and find a definition of a register used in a shuffle instruction and
then decode that, but this seems incredibly brittle and complex.
I talked to Hal a lot about the "right" way to do this: attach the raw
shuffle mask to the instruction itself in some form of unencoded
operands, and then use that to emit the comments. I still think that's
the optimal solution here, but it proved to be beyond what I'm up for
here. In particular, it seems likely best done by completing the
plumbing of metadata through these layers and attaching the shuffle mask
in metadata which could have fully automatic dropping when encoding an
actual instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218377
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Wed, 24 Sep 2014 04:59:06 +0000 (04:59 +0000)]
Allow BB duplication threshold to be adjusted through JumpThreading's ctor
- BB duplication may not be desired on targets where there is no or small
branch penalty and code duplication needs restrict control.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218375
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:45:14 +0000 (04:45 +0000)]
Windows/Host.inc: Reformat the header to fit 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218374
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:45:02 +0000 (04:45 +0000)]
Unix/Host.inc: Remove <cstdlib>. It has been unused for a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218373
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:44:50 +0000 (04:44 +0000)]
Unix/Host.inc: Wrap a comment line in 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218371
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:44:37 +0000 (04:44 +0000)]
Unix/Host.inc: Remove leading whitespace. It had been here since r56942!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218370
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:38:20 +0000 (04:38 +0000)]
valgrind/x86_64-pc-linux-gnu.supp: Suppress also /bin/bash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218369
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 24 Sep 2014 04:38:09 +0000 (04:38 +0000)]
valgrind/x86_64-pc-linux-gnu.supp: Tweak /bin/sed to let calloc recognized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218368
91177308-0d34-0410-b5e6-
96231b3b80d8
Jiangning Liu [Wed, 24 Sep 2014 03:22:56 +0000 (03:22 +0000)]
Clear PreferredExtendType for in each function-specific state FunctionLoweringInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218364
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 03:06:37 +0000 (03:06 +0000)]
[x86] More refactoring of the shuffle comment emission. The previous
attempt didn't work out so well. It looks like it will be much better
for introducing extra logic to find a shuffle mask if the finding logic
is totally separate. This also makes it easy to sink the opcode logic
completely out of the routine so we don't re-dispatch across it.
Still no functionality changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218363
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 03:06:34 +0000 (03:06 +0000)]
[x86] Bypass the shuffle mask comment generation when not using verbose
asm. This can be somewhat expensive and there is no reason to do it
outside of tests or debugging sessions. I'm also likely to make it
significantly more expensive to support more styles of shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218362
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 02:24:41 +0000 (02:24 +0000)]
[x86] Hoist the logic for extracting the relevant bits of information
from the MachineInstr into the caller which is already doing a switch
over the instruction.
This will make it more clear how to compute different operands to feed
the comment selection for example.
Also, in a drive-by-fix, don't append an empty comment string (which is
a no-op ultimately).
No functionality changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218361
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 24 Sep 2014 02:17:12 +0000 (02:17 +0000)]
R600/SI: Add new helper isSGPRClassID
Move these into header since they are trivial
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218360
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 24 Sep 2014 02:17:09 +0000 (02:17 +0000)]
R600/SI: Fix hardcoded and wrong operand numbers.
Also fix leftover debug printing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218359
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 24 Sep 2014 02:17:06 +0000 (02:17 +0000)]
R600/SI: Enable named operand table for SALU instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218358
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 02:16:12 +0000 (02:16 +0000)]
[x86] Start refactoring the comment printing logic in the MC lowering of
vector shuffles.
This is just the beginning by hoisting it into its own function and
making use of early exit to dramatically simplify the flow of the
function. I'm going to be incrementally refactoring this until it is
a bit less magical how this applies to other instructions, and I can
teach it how to dig a shuffle mask out of a register. Then I plan to
hook it up to VPERMD so we get our mask comments for it.
No functionality changed yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218357
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 24 Sep 2014 02:14:26 +0000 (02:14 +0000)]
R600/SI: Fix weird CHECK-DAG usage
This prevents these from failing in a future commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218356
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:28 +0000 (01:33 +0000)]
R600/SI: Enable selecting SALU inside branches
We can do this now that the FixSGPRLiveRanges pass is working.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218353
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:26 +0000 (01:33 +0000)]
R600/SI: Move PHIs that define SGPRs to the VALU in most cases
This fixes a bug that is uncovered by a future commit and will
be tested by the test/CodeGen/R600/sgpr-control-flow.ll test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218352
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:24 +0000 (01:33 +0000)]
R600/SI: Fix the FixSGPRLiveRanges pass
The previous implementation was extending the live range of SGPRs
by modifying the live intervals directly. This was causing a lot
of machine verification errors when the machine scheduler was enabled.
The new implementation adds pseudo instructions with implicit uses to
extend the live ranges of SGPRs, which works much better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218351
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:23 +0000 (01:33 +0000)]
R600/SI: Mark EXEC_LO and EXEC_HI as reserved
These registers can be allocated and used like other 32-bit registers,
but it seems like a likely source for bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218350
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:22 +0000 (01:33 +0000)]
R600/SI: Fix SIRegisterInfo::getPhysRegSubReg()
Correctly handle special registers: EXEC, EXEC_LO, EXEC_HI, VCC_LO,
VCC_HI, and M0. The previous implementation would assertion fail
when passed these registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218349
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 24 Sep 2014 01:33:17 +0000 (01:33 +0000)]
R600/SI: Implement VGPR register spilling for compute at -O0 v3
VGPRs are spilled to LDS. This still needs more testing, but
we need to at least enable it at -O0, because the fast register
allocator spills all registers that are live at the end of blocks
and without this some future commits will break the
flat-address-space.ll test.
v2: Only calculate thread id once
v3: Move insertion of spill instructions to
SIRegisterInfo::eliminateFrameIndex()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218348
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 01:24:44 +0000 (01:24 +0000)]
[x86] Teach the new vector shuffle lowering to lower v8i32 shuffles with
the native AVX2 instructions.
Note that the test case is really frustrating here because VPERMD
requires the mask to be in the register input and we don't produce
a comment looking through that to the constant pool. I'm going to
attempt to improve this in a subsequent commit, but not sure if I will
succeed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218347
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 24 Sep 2014 01:03:57 +0000 (01:03 +0000)]
[x86] Fix a really terrible bug in the repeated 128-bin-lane shuffle
detection. It was incorrectly handling undef lanes by actually treating
an undef lane in the first 128-bit lane as a *numeric* shuffle value.
Fortunately, this almost always DTRT and disabled detecting repeated
patterns. But not always. =/ This patch introduces a much more
principled approach and fixes the miscompiles I spotted by inspection
previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218346
91177308-0d34-0410-b5e6-
96231b3b80d8
Robin Morisset [Tue, 23 Sep 2014 23:18:01 +0000 (23:18 +0000)]
Fix swift-atomics testcase
This testcase was not testing what it meant: because there were only two checks for
dmb {{ish}} in the second function, it could have missed a bug where one of the three
required dmb {{ish}} became dmb {{ishst}}. As I was fixing it, I also added
CHECK-LABELs to make it a bit less brittle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218341
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 23 Sep 2014 22:39:02 +0000 (22:39 +0000)]
[x86] Teach the new vector shuffle lowering to lower v4i64 vector
shuffles using the AVX2 instructions. This is the first step of cutting
in real AVX2 support.
Note that I have spotted at least one bug in the test cases already, but
I suspect it was already present and just is getting surfaced. Will
investigate next.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218338
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Tue, 23 Sep 2014 22:33:01 +0000 (22:33 +0000)]
GlobalOpt: Preserve comdats of unoptimized initializers
Rather than slurping in and splatting out the whole ctor list, preserve
the existing array entries without trying to understand them. Only
remove the entries that we know we can optimize away. This way we don't
need to wire through priority and comdats or anything else we might add.
Fixes a linker issue where the .init_array or .ctors entry would point
to discarded initialization code if the comdat group from the TU with
the faulty global_ctors entry was dropped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218337
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Grosbach [Tue, 23 Sep 2014 22:16:02 +0000 (22:16 +0000)]
AArch64: allow constant expressions for shifted reg literals
e.g., add w1, w2, w3, lsl #(2 - 1)
This sort of thing comes up in pre-processed assembly playing macro games.
Still validate that it's an assembly time constant. The early exit error check
was just a bit overzealous and disallowed a left paren.
rdar://
18430542
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218336
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 23 Sep 2014 22:14:14 +0000 (22:14 +0000)]
[x86] Teach the rest of the 'target shuffle' machinery about blends and
add VPBLENDD to the InstPrinter's comment generation so we get nice
comments everywhere.
Now that we have the nice comments, I can see the bug introduced by
a silly typo in the commit that enabled VPBLENDD, and have fixed it. Yay
tests that are easy to inspect.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218335
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Tue, 23 Sep 2014 21:26:25 +0000 (21:26 +0000)]
R600/SI: Clean up checks for legality of immediate operands
There are new register classes VCSrc_* which represent operands that
can take an SGPR, VGPR or inline constant. The VSrc_* class is now used
to represent operands that can take an SGPR, VGPR, or a 32-bit
immediate.
This allows us to have more accurate checks for legality of
immediates, since before we had no way to distinguish between operands
that supported any 32-bit immediate and operands which could only
support inline constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218334
91177308-0d34-0410-b5e6-
96231b3b80d8
Robin Morisset [Tue, 23 Sep 2014 20:59:25 +0000 (20:59 +0000)]
[X86] Make wide loads be managed by AtomicExpand
Summary:
AtomicExpand already had logic for expanding wide loads and stores on LL/SC
architectures, and for expanding wide stores on CmpXchg architectures, but
not for wide loads on CmpXchg architectures. This patch fills this hole,
and makes use of this new feature in the X86 backend.
Only one functionnal change: we now lose the SynchScope attribute.
It is regrettable, but I have another patch that I will submit soon that will
solve this for all of AtomicExpand (it seemed better to split it apart as it
is a different concern).
Test Plan: make check-all (lots of tests for this functionality already exist)
Reviewers: jfb
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5404
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218332
91177308-0d34-0410-b5e6-
96231b3b80d8
Robin Morisset [Tue, 23 Sep 2014 20:46:49 +0000 (20:46 +0000)]
[Power] Use AtomicExpandPass for fence insertion, and use lwsync where appropriate
Summary:
This patch makes use of AtomicExpandPass in Power for inserting fences around
atomic as part of an effort to remove fence insertion from SelectionDAGBuilder.
As a big bonus, it lets us use sync 1 (lightweight sync, often used by the mnemonic
lwsync) instead of sync 0 (heavyweight sync) in many cases.
I also added a test, as there was no test for the barriers emitted by the Power
backend for atomic loads and stores.
Test Plan: new test + make check-all
Reviewers: jfb
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5180
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218331
91177308-0d34-0410-b5e6-
96231b3b80d8
Robin Morisset [Tue, 23 Sep 2014 20:31:14 +0000 (20:31 +0000)]
Add AtomicExpandPass::bracketInstWithFences, and use it whenever getInsertFencesForAtomic would trigger in SelectionDAGBuilder
Summary:
The goal is to eventually remove all the code related to getInsertFencesForAtomic
in SelectionDAGBuilder as it is wrong (designed for ARM, not really portable, works
mostly by accident because the backends are overly conservative), and repeats the
same logic that goes in emitLeading/TrailingFence.
In this patch, I make AtomicExpandPass insert the fences as it knows better
where to put them. Because this requires getting the fences and not just
passing an IRBuilder around, I had to change the return type of
emitLeading/TrailingFence.
This code only triggers on ARM for now. Because it is earlier in the pipeline
than SelectionDAGBuilder, it triggers and lowers atomic accesses to atomic so
SelectionDAGBuilder does not add barriers anymore on ARM.
If this patch is accepted I plan to implement emitLeading/TrailingFence for all
backends that setInsertFencesForAtomic(true), which will allow both making them
less conservative and simplifying SelectionDAGBuilder once they are all using
this interface.
This should not cause any functionnal change so the existing tests are used
and not modified.
Test Plan: make check-all, benefits from existing tests of atomics on ARM
Reviewers: jfb, t.p.northover
Subscribers: aemerson, llvm-commits
Differential Revision: http://reviews.llvm.org/D5179
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218329
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 19:20:57 +0000 (19:20 +0000)]
[MCJIT] Fix some more RuntimeDyld debugging output format specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218328
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 19:17:48 +0000 (19:17 +0000)]
[MCJIT] Remove PPCRelocations.h - it's no longer used.
This was overlooked in r218320, which removed the relocation headers for other
targets. Thanks to Ulrich Weigand for catching it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218327
91177308-0d34-0410-b5e6-
96231b3b80d8
Robin Morisset [Tue, 23 Sep 2014 18:33:21 +0000 (18:33 +0000)]
Just add a fixme about a possibly faster implementation of some atomic loads on some ARM processors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218326
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Tue, 23 Sep 2014 18:30:57 +0000 (18:30 +0000)]
Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218324
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 23 Sep 2014 18:16:12 +0000 (18:16 +0000)]
[x86] Teach the new shuffle lowering's blend functionality to use AVX2's
VPBLENDD where appropriate even on 128-bit vectors.
According to Agner's tables, this instruction is significantly higher
throughput (can execute on any port) on Haswell chips so we should
aggressively try to form it when available.
Sadly, this loses our delightful shuffle comments. I'll add those back
for VPBLENDD next.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218322
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 18:08:47 +0000 (18:08 +0000)]
[MCJIT] Nuke MachineRelocation and MachineCodeEmitter. Now that the old JIT is
gone they're no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218320
91177308-0d34-0410-b5e6-
96231b3b80d8
Jingyue Wu [Tue, 23 Sep 2014 17:35:28 +0000 (17:35 +0000)]
[docs] Fixed a typo in Atomics.rst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218319
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 17:10:24 +0000 (17:10 +0000)]
[MCJIT] Remove a few more references to JITMemoryManager that survived r218316.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218318
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 17:02:24 +0000 (17:02 +0000)]
[MCJIT] Remove #include of JITMemoryManager that accidentally survived r218316.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218317
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 23 Sep 2014 16:56:02 +0000 (16:56 +0000)]
[MCJIT] Delete the JTIMemoryManager and associated APIs.
This patch removes the old JIT memory manager (which does not provide any
useful functionality now that the old JIT is gone), and migrates the few
remaining clients over to SectionMemoryManager.
http://llvm.org/PR20848
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218316
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Tue, 23 Sep 2014 16:24:20 +0000 (16:24 +0000)]
Use SDValue bool operator to reduce code. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218314
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Tue, 23 Sep 2014 15:38:11 +0000 (15:38 +0000)]
Fix segfault in AArch64 backend with -g and -mbig-endian
Fix a null pointer dereference when trying to swap the endianness of
fixups in the .eh_frame section in the AArch64 backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218311
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 23 Sep 2014 14:41:02 +0000 (14:41 +0000)]
Rework r218304, "ExecutionEngineTests: Call llvm_shutdown() on exit for ManagedStatic introduced in r218151."
r218304 caused crash on msvc builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218308
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 23 Sep 2014 14:19:09 +0000 (14:19 +0000)]
valgrind/x86_64-pc-linux-gnu.supp: We don't care if sed leaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218307
91177308-0d34-0410-b5e6-
96231b3b80d8
Timur Iskhodzhanov [Tue, 23 Sep 2014 14:07:12 +0000 (14:07 +0000)]
Fix a small typo in the test comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218306
91177308-0d34-0410-b5e6-
96231b3b80d8
Sid Manning [Tue, 23 Sep 2014 13:55:50 +0000 (13:55 +0000)]
Loop instead of individual def's for each GPR.
Differential Revision: http://reviews.llvm.org/D5450
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218305
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 23 Sep 2014 13:49:51 +0000 (13:49 +0000)]
ExecutionEngineTests: Call llvm_shutdown() on exit for ManagedStatic introduced in r218151.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218304
91177308-0d34-0410-b5e6-
96231b3b80d8
Timur Iskhodzhanov [Tue, 23 Sep 2014 13:49:51 +0000 (13:49 +0000)]
Rebuild the inputs for the codeview-linetables.test with VS2013
Also provide reproducible instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218303
91177308-0d34-0410-b5e6-
96231b3b80d8
Petar Jovanovic [Tue, 23 Sep 2014 12:54:19 +0000 (12:54 +0000)]
Do not destroy external linkage when deleting function body
The function deleteBody() converts the linkage to external and thus destroys
original linkage type value. Lack of correct linkage type causes wrong
relocations to be emitted later.
Calling dropAllReferences() instead of deleteBody() will fix the issue.
Differential Revision: http://reviews.llvm.org/D5415
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218302
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 23 Sep 2014 11:15:19 +0000 (11:15 +0000)]
[x86] Teach the vector comment parsing and printing to correctly handle
undef in the shuffle mask. This shows up when we're printing comments
during lowering and we still have an IR-level constant hanging around
that models undef.
A nice consequence of this is *much* prettier test cases where the undef
lanes actually show up as undef rather than as a particular set of
values. This also allows us to print shuffle comments in cases that use
undef such as the recently added variable VPERMILPS lowering. Now those
test cases have nice shuffle comments attached with their details.
The shuffle lowering for PSHUFB has been augmented to use undef, and the
shuffle combining has been augmented to comprehend it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218301
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 23 Sep 2014 10:08:29 +0000 (10:08 +0000)]
[x86] Teach the AVX1 path of the new vector shuffle lowering one more
trick that I missed.
VPERMILPS has a non-immediate memory operand mode that allows it to do
asymetric shuffles in the two 128-bit lanes. Use this rather than two
shuffles and a blend.
However, it turns out the variable shuffle path to VPERMILPS (and
VPERMILPD, although that one offers no functional differenc from the
immediate operand other than variability) wasn't even plumbed through
codegen. Do such plumbing so that we can reasonably emit
a variable-masked VPERMILP instruction. Also plumb basic comment parsing
and printing through so that the tests are reasonable.
There are still a few tests which don't show the shuffle pattern. These
are tests with undef lanes. I'll teach the shuffle decoding and printing
to handle undef mask entries in a follow-up. I've looked at the masks
and they seem reasonable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218300
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Kuperstein [Tue, 23 Sep 2014 08:48:01 +0000 (08:48 +0000)]
Ensure bitcode encoding stays stable.
This includes constants, attributes, and some additional instructions not covered by previous tests.
Work was done by lama.saba@intel.com.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218297
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 23 Sep 2014 06:06:43 +0000 (06:06 +0000)]
[ADT/IntrusiveRefCntPtr] Give friend access to IntrusiveRefCntPtr<X> so the relevant move constructor can access 'Obj'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218295
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 23 Sep 2014 01:09:46 +0000 (01:09 +0000)]
Windows/DynamicLibrary.inc: Remove 'extern "C"' in ELM_Callback.
'extern "C" static' is not accepted by g++-4.7. Rather to tweak, I just removed 'extern "C"', since it doesn't affect the ABI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218290
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Mon, 22 Sep 2014 22:46:44 +0000 (22:46 +0000)]
tighten up checks
We manage to generate all of the matching instructions (and a lot more) via
the reciprocal optimization function - even if we completely remove the square
root optimization. With CHECK_NEXT, we assure that we're executing the
expected square root optimization paths and not generating extra insts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218284
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Mon, 22 Sep 2014 22:39:20 +0000 (22:39 +0000)]
Converting terminalHasColors mutex to a global ManagedStatic to avoid the static destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218283
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Mon, 22 Sep 2014 22:29:42 +0000 (22:29 +0000)]
[x86] Rename X86ISD::VPERMILP to X86ISD::VPERMILPI (and the same for the
td pattern). Currently we only model the immediate operand variation of
VPERMILPS and VPERMILPD, we should make that clear in the pseudos used.
Will be adding support for the variable mask variant in my next commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218282
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Mon, 22 Sep 2014 22:17:59 +0000 (22:17 +0000)]
Fix a "typo" from my previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218281
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Mon, 22 Sep 2014 22:14:13 +0000 (22:14 +0000)]
Silence unused variable warnings in the new stub functions that occur
when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218280
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Mon, 22 Sep 2014 21:52:53 +0000 (21:52 +0000)]
remove unnecessary labels; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218278
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Mon, 22 Sep 2014 21:45:57 +0000 (21:45 +0000)]
[x86] Stub out the integer lowering of 256-bit vectors with AVX2
support. No interesting functionality yet, but this will let me
implement one vector type at a time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218277
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Mon, 22 Sep 2014 21:40:15 +0000 (21:40 +0000)]
In this callback ModuleName includes the file path.
Comparing ModuleName to the file names listed will
always fail.
I wonder how this code ever worked and what its
purpose was. Why exclude the msvc runtime DLLs
but not exclude all Windows system DLLs?
Anyhow, it does not function as intended.
clang-formatted as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218276
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Mon, 22 Sep 2014 21:08:53 +0000 (21:08 +0000)]
[FastISel][AArch64] Also allow folding of sign-/zero-extend and shift-left for booleans (i1).
Shift-left immediate with sign-/zero-extensions also works for boolean values.
Update the assert and the test cases to reflect that fact.
This should fix a bug found by Chad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218275
91177308-0d34-0410-b5e6-
96231b3b80d8
Ehsan Akhgari [Mon, 22 Sep 2014 20:40:36 +0000 (20:40 +0000)]
ms-inline-asm: Fix parsing label names inside bracket expressions
Summary:
This fixes a couple of issues. One is ensuring that AOK_Label rewrite
rules have a lower priority than AOK_Skip rules, as AOK_Skip needs to
be able to skip the brackets properly. The other part of the fix ensures
that we don't overwrite Identifier when looking up the identifier, and
that we use the locally available information to generate the AOK_Label
rewrite in ParseIntelIdentifier. Doing that in CreateMemForInlineAsm
would be problematic since the Start location there may point to the
beginning of a bracket expression, and not necessarily the beginning of
an identifier.
This also means that we don't need to carry around the InternlName field,
which helps simplify the code.
Test Plan: This will be tested on the clang side.
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5445
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218270
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 22 Sep 2014 20:39:23 +0000 (20:39 +0000)]
MC: ReadOnlyWithRel section kinds should map to rdata in COFF
Don't consider ReadOnlyWithRel as a writable section in COFF, they
really belong in .rdata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218268
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Mon, 22 Sep 2014 20:25:08 +0000 (20:25 +0000)]
[x86] Introduce tests covering the gamut of 256-bit vector shuffling.
These are just test cases, no actual code yet. This establishes the
baseline fallback strategy we're starting from on AVX2 and the expected
lowering we use on AVX1.
Also, these test cases are very much generated. I've manually crafted
the specific pattern set that I'm hoping will be useful at exercising
the lowering code, but I've not (and could not) manually verify *all* of
these. I've spot checked and they seem legit to me.
As with the rest of vector shuffling, at a certain point the only really
useful way to check the correctness of this stuff is through fuzz
testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218267
91177308-0d34-0410-b5e6-
96231b3b80d8
Ehsan Akhgari [Mon, 22 Sep 2014 19:49:07 +0000 (19:49 +0000)]
Make MCAsmParserSemaCallback::LookupInlineAsmLabel a pure virtual function
Summary:
r218229 made this function return a dummy nullptr in order to avoid
API breakage between clang/llvm.
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5432
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218266
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Mon, 22 Sep 2014 18:54:01 +0000 (18:54 +0000)]
Use broadcasts to optimize overall size when loading constant splat vectors (x86-64 with AVX or AVX2).
We generate broadcast instructions on CPUs with AVX2 to load some constant splat vectors.
This patch should preserve all existing behavior with regular optimization levels,
but also use splats whenever possible when optimizing for *size* on any CPU with AVX or AVX2.
The tradeoff is up to 5 extra instruction bytes for the broadcast instruction to save
at least 8 bytes (up to 31 bytes) of constant pool data.
Differential Revision: http://reviews.llvm.org/D5347
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218263
91177308-0d34-0410-b5e6-
96231b3b80d8