oota-llvm.git
12 years agoAllow CRC32 instructions to be selected when AVX is enabled.
Craig Topper [Sun, 1 Jan 2012 19:51:58 +0000 (19:51 +0000)]
Allow CRC32 instructions to be selected when AVX is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147411 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix sfence, lfence, mfence, and clflush to be able to be selected when AVX is enabled...
Craig Topper [Sun, 1 Jan 2012 19:40:22 +0000 (19:40 +0000)]
Fix sfence, lfence, mfence, and clflush to be able to be selected when AVX is enabled. Fix monitor and mwait to require SSE3 or AVX, previously they worked even if SSE3 was disabled. Make prefetch instructions not set the execution domain since they don't use XMM registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147409 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoX86Disassembler: Fix undefined behavior found by GCC 4.6
Benjamin Kramer [Sun, 1 Jan 2012 17:55:36 +0000 (17:55 +0000)]
X86Disassembler: Fix undefined behavior found by GCC 4.6

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147404 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPatternMatch: Introduce a matcher for instructions with the "exact" bit. Use it to...
Benjamin Kramer [Sun, 1 Jan 2012 17:55:30 +0000 (17:55 +0000)]
PatternMatch: Introduce a matcher for instructions with the "exact" bit. Use it to simplify a few matchers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147403 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPatternMatch: Simplify code by reusing the Operator class.
Benjamin Kramer [Sun, 1 Jan 2012 17:55:23 +0000 (17:55 +0000)]
PatternMatch: Simplify code by reusing the Operator class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147402 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert 147399. It broke CodeGen/ARM/vext.ll.
Rafael Espindola [Sun, 1 Jan 2012 17:36:23 +0000 (17:36 +0000)]
Revert 147399. It broke CodeGen/ARM/vext.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147400 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixed a bug in SelectionDAG.cpp.
Elena Demikhovsky [Sun, 1 Jan 2012 16:22:47 +0000 (16:22 +0000)]
Fixed a bug in SelectionDAG.cpp.
The failure seen on win32, when i64 type is illegal.
It happens on stage of conversion VECTOR_SHUFFLE to BUILD_VECTOR.

The failure message is:
llc: SelectionDAG.cpp:784: void VerifyNodeCommon(llvm::SDNode*): Assertion `(I->getValueType() == EltVT || (EltVT.isInteger() && I->getValueType().isInteger() && EltVT.bitsLE(I->getValueType()))) && "Wrong operand type!"' failed.

I added a special test that checks vector shuffle on win32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147399 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHappy new year 2012!
NAKAMURA Takumi [Sun, 1 Jan 2012 08:16:56 +0000 (08:16 +0000)]
Happy new year 2012!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147395 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMerge X86 SHUFPS and SHUFPD node types.
Craig Topper [Sat, 31 Dec 2011 23:50:21 +0000 (23:50 +0000)]
Merge X86 SHUFPS and SHUFPD node types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147394 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd patterns for integer forms of SHUFPD/VSHUFPD with a memory load.
Craig Topper [Sat, 31 Dec 2011 23:24:49 +0000 (23:24 +0000)]
Add patterns for integer forms of SHUFPD/VSHUFPD with a memory load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147393 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix typo in a SHUFPD and VSHUFPD pattern that prevented SHUFPD/VSHUFPD with a load...
Craig Topper [Sat, 31 Dec 2011 23:15:11 +0000 (23:15 +0000)]
Fix typo in a SHUFPD and VSHUFPD pattern that prevented SHUFPD/VSHUFPD with a load from being selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147392 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate the
Nick Lewycky [Sat, 31 Dec 2011 21:30:22 +0000 (21:30 +0000)]
Make use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate the
'and' that would zero out the trailing bits, and to produce an exact shift
ourselves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147391 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoVMCore: add assert for miscompile
Dylan Noblesmith [Sat, 31 Dec 2011 13:58:58 +0000 (13:58 +0000)]
VMCore: add assert for miscompile

See PR11652. Trying to add this assert to
setSubclassData() itself actually prevented
the miscompile entirely, so it has to be here.

This makes the source of the bug more obvious
than the other asserts triggering later on did.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147390 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup Mips code and rename some variables. Patch by Jack Carter
Bruno Cardoso Lopes [Fri, 30 Dec 2011 21:09:41 +0000 (21:09 +0000)]
Cleanup Mips code and rename some variables. Patch by Jack Carter

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147383 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImprove Mips JIT.
Bruno Cardoso Lopes [Fri, 30 Dec 2011 21:04:30 +0000 (21:04 +0000)]
Improve Mips JIT.

Implement encoder methods getJumpTargetOpValue and getBranchTargetOpValue
for jmptarget and brtarget Mips tablegen operand types in the code emitter
for old-style JIT. Rename the pc relative relocation for branches - new
name is Mips::reloc_mips_pc16.

Patch by Sasa Stankovic

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147382 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove extraneous ".get()->" which is just "->". No functionality change.
Nick Lewycky [Fri, 30 Dec 2011 19:17:23 +0000 (19:17 +0000)]
Remove extraneous ".get()->" which is just "->". No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147379 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake FMA4 imply AVX so that YMM registers would be available. Necessitates removing...
Craig Topper [Fri, 30 Dec 2011 07:16:00 +0000 (07:16 +0000)]
Make FMA4 imply AVX so that YMM registers would be available. Necessitates removing from Bulldozer CPU types since it would enable AVX code generation implicitly. Also make SSE4A imply SSE3. Without some level of SSE implied, XMM registers wouldn't be legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147369 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd disassembler support for VPERMIL2PD and VPERMIL2PS.
Craig Topper [Fri, 30 Dec 2011 06:23:39 +0000 (06:23 +0000)]
Add disassembler support for VPERMIL2PD and VPERMIL2PS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147368 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd FMA4 instructions to disassembler.
Craig Topper [Fri, 30 Dec 2011 05:20:36 +0000 (05:20 +0000)]
Add FMA4 instructions to disassembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147367 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSeparate the concept of having memory access in operand 4 from the concept of having...
Craig Topper [Fri, 30 Dec 2011 04:48:54 +0000 (04:48 +0000)]
Separate the concept of having memory access in operand 4 from the concept of having the W bit set for XOP instructons. Removes ORing W-bits in the encoder and will similarly simplify the disassembler implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147366 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCombine FMA4 SS/SD patterns with the instruction definitions.
Craig Topper [Fri, 30 Dec 2011 03:33:59 +0000 (03:33 +0000)]
Combine FMA4 SS/SD patterns with the instruction definitions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147365 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCombine FMA4 PS/PD patterns with the instruction definitions.
Craig Topper [Fri, 30 Dec 2011 03:17:15 +0000 (03:17 +0000)]
Combine FMA4 PS/PD patterns with the instruction definitions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147364 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChange FMA4 memory forms to use memopv* instead of alignedloadv*. No need to force...
Craig Topper [Fri, 30 Dec 2011 02:18:36 +0000 (02:18 +0000)]
Change FMA4 memory forms to use memopv* instead of alignedloadv*. No need to force alignment on these instructions. Add a couple testcases for memory forms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147361 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix load size for FMA4 SS/SD instructions. They need to use f32 and f64 size, but...
Craig Topper [Fri, 30 Dec 2011 01:49:53 +0000 (01:49 +0000)]
Fix load size for FMA4 SS/SD instructions. They need to use f32 and f64 size, but with the special handling to be compatible with the intrinsic expecting a vector. Similar handling is already used elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147360 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup stack/frame register define/kill states. This fixes two bugs:
Hal Finkel [Fri, 30 Dec 2011 00:34:00 +0000 (00:34 +0000)]
Cleanup stack/frame register define/kill states. This fixes two bugs:

1. The ST*UX instructions that store and update the stack pointer did not set define/kill on R1. This became a problem when I activated post-RA scheduling (and had incorrectly adjusted the Frames-large test).

2. eliminateFrameIndex did not kill its scavenged temporary register, and this could cause the scavenger to exhaust all available registers (and its emergency spill slot) when there were a lot of CR values to spill. The 2010-02-12-saveCR test has been adjusted to check for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147359 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement cfi_restore. Patch by Brian Anderson!
Rafael Espindola [Thu, 29 Dec 2011 21:43:03 +0000 (21:43 +0000)]
Implement cfi_restore. Patch by Brian Anderson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147356 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename Remember and Restore to RememberState and RestoreState for consistency.
Rafael Espindola [Thu, 29 Dec 2011 21:09:08 +0000 (21:09 +0000)]
Rename Remember and Restore to RememberState and RestoreState for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147354 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix execution domains for PS/PD FMA3 instructions. Add SS/SD forms o FMA3 instructions.
Craig Topper [Thu, 29 Dec 2011 20:43:40 +0000 (20:43 +0000)]
Fix execution domains for PS/PD FMA3 instructions. Add SS/SD forms o FMA3 instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147353 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement .cfi_escape. Patch by Brian Anderson!
Rafael Espindola [Thu, 29 Dec 2011 20:24:47 +0000 (20:24 +0000)]
Implement .cfi_escape. Patch by Brian Anderson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147352 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoExpose FMA3 instructions to the disassembler.
Craig Topper [Thu, 29 Dec 2011 20:03:14 +0000 (20:03 +0000)]
Expose FMA3 instructions to the disassembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147351 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake FMA3 imply AVX needs to be enabled. Particularly because 256-bit types aren...
Craig Topper [Thu, 29 Dec 2011 19:46:19 +0000 (19:46 +0000)]
Make FMA3 imply AVX needs to be enabled. Particularly because 256-bit types aren't valid unless AVX is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147349 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChange XOP detection to use the correct CPUID bit instead of using the FMA4 bit.
Craig Topper [Thu, 29 Dec 2011 19:25:56 +0000 (19:25 +0000)]
Change XOP detection to use the correct CPUID bit instead of using the FMA4 bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147348 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd FeaturePOPCNT to all CPU types that lost it was removed from SSE42/SSE4A in r147339.
Craig Topper [Thu, 29 Dec 2011 18:47:31 +0000 (18:47 +0000)]
Add FeaturePOPCNT to all CPU types that lost it was removed from SSE42/SSE4A in r147339.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147347 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMark non-VEX forms of PCLMUL instructions as requiring SSE2 to be enabled along with...
Craig Topper [Thu, 29 Dec 2011 18:08:36 +0000 (18:08 +0000)]
Mark non-VEX forms of PCLMUL instructions as requiring SSE2 to be enabled along with CLMUL. That's required for the XMM registers to be valid for integer data. Doesn't change any behavior since the CLMUL instructions don't have patterns yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147345 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMark non-VEX forms of AES instructions as requiring SSE2 to be enabled along with...
Craig Topper [Thu, 29 Dec 2011 18:00:08 +0000 (18:00 +0000)]
Mark non-VEX forms of AES instructions as requiring SSE2 to be enabled along with AES. Since that's required for the XMM registers to be valid for integer data. Doesn't change any behavior though since you can't use an intrinsic with an illegal type anyway. Just makes it consistent with the VEX forms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147344 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the separate explicit AES instruction patterns. They are equivalent to the...
Craig Topper [Thu, 29 Dec 2011 17:41:56 +0000 (17:41 +0000)]
Remove the separate explicit AES instruction patterns. They are equivalent to the patterns specified by the instructions. Also remove unnecessary bitconverts from the AES patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake SSE42 and SSE4A not imply POPCNT. POPCNT should be able to be disabled on its...
Craig Topper [Thu, 29 Dec 2011 15:51:45 +0000 (15:51 +0000)]
Make SSE42 and SSE4A not imply POPCNT. POPCNT should be able to be disabled on its own without disabling SSE4.2 or SSE4A.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147339 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake LowerBUILD_VECTOR keep node vector types consistent when creating MOVL for v16i1...
Craig Topper [Thu, 29 Dec 2011 03:34:54 +0000 (03:34 +0000)]
Make LowerBUILD_VECTOR keep node vector types consistent when creating MOVL for v16i16 and v32i8.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147337 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove some elses after returns.
Craig Topper [Thu, 29 Dec 2011 03:20:51 +0000 (03:20 +0000)]
Remove some elses after returns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147336 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove trailing spaces. Fix an assert to use && instead of || before string. Add...
Craig Topper [Thu, 29 Dec 2011 03:09:33 +0000 (03:09 +0000)]
Remove trailing spaces. Fix an assert to use && instead of || before string. Add same assert on similar code path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147335 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix grammar error noticed by Duncan.
Rafael Espindola [Thu, 29 Dec 2011 02:15:06 +0000 (02:15 +0000)]
Fix grammar error noticed by Duncan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147333 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChange CaptureTracking to pass a Use* instead of a Value* when a value is
Nick Lewycky [Wed, 28 Dec 2011 23:24:21 +0000 (23:24 +0000)]
Change CaptureTracking to pass a Use* instead of a Value* when a value is
captured. This allows the tracker to look at the specific use, which may be
especially interesting for function calls.

Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does
not iterate until a fixpoint and does not guarantee that it produces the same
result regardless of iteration order. The new implementation builds up a graph
of how arguments are passed from function to function, and uses a bottom-up walk
on the argument-SCCs to assign nocapture. This gets us nocapture more often, and
does so rather efficiently and independent of iteration order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147327 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix type-checking for load transformation which is not legal on floating-point types...
Eli Friedman [Wed, 28 Dec 2011 21:24:44 +0000 (21:24 +0000)]
Fix type-checking for load transformation which is not legal on floating-point types.  PR11674.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147323 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate OCaml bindings for the new half float type.
Bob Wilson [Wed, 28 Dec 2011 18:51:08 +0000 (18:51 +0000)]
Update OCaml bindings for the new half float type.
Patch by Jonathan Ragan-Kelley!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147314 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for mipsel in configure. Fixes PR11669. Patch by Sylvestre Ledru.
Rafael Espindola [Wed, 28 Dec 2011 17:08:00 +0000 (17:08 +0000)]
Add support for mipsel in configure. Fixes PR11669. Patch by Sylvestre Ledru.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147312 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR11662.
Nadav Rotem [Wed, 28 Dec 2011 13:08:20 +0000 (13:08 +0000)]
PR11662.

Promotion of the mask operand needs to be done using PromoteTargetBoolean, and not padded with garbage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147309 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixed a bug in LowerVECTOR_SHUFFLE and LowerBUILD_VECTOR.
Elena Demikhovsky [Wed, 28 Dec 2011 08:14:01 +0000 (08:14 +0000)]
Fixed a bug in LowerVECTOR_SHUFFLE and LowerBUILD_VECTOR.
Matching MOVLP mask for AVX (265-bit vectors) was wrong.
The failure was detected by conformance tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147308 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDemystify this comment.
Nick Lewycky [Wed, 28 Dec 2011 06:57:32 +0000 (06:57 +0000)]
Demystify this comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147307 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR11642 has been fixed, enable -fvisibility-inlines-hidden everywhere.
Rafael Espindola [Tue, 27 Dec 2011 21:37:11 +0000 (21:37 +0000)]
PR11642 has been fixed, enable -fvisibility-inlines-hidden everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147296 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch StringMap from an array of structures to a structure of arrays.
Benjamin Kramer [Tue, 27 Dec 2011 20:35:07 +0000 (20:35 +0000)]
Switch StringMap from an array of structures to a structure of arrays.

- -25% memory usage of the main table on x86_64 (was wasted in struct padding).
- no significant performance change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147294 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse false not zero, as a bool.
Nick Lewycky [Tue, 27 Dec 2011 18:27:22 +0000 (18:27 +0000)]
Use false not zero, as a bool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTurn cos(-x) into cos(x). Patch by Alexander Malyshev!
Nick Lewycky [Tue, 27 Dec 2011 18:25:50 +0000 (18:25 +0000)]
Turn cos(-x) into cos(x). Patch by Alexander Malyshev!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147291 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoClean up some Release build warnings.
Benjamin Kramer [Tue, 27 Dec 2011 11:41:05 +0000 (11:41 +0000)]
Clean up some Release build warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147289 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd handling of x86_avx2_pmovmskb to computeMaskedBitsForTargetNode for consistency...
Craig Topper [Tue, 27 Dec 2011 06:27:23 +0000 (06:27 +0000)]
Add handling of x86_avx2_pmovmskb to computeMaskedBitsForTargetNode for consistency. Add comments and an assert for BMI instructions to PerformXorCombine since the enabling of the combine is conditional on it, but the function itself isn't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147287 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTeach simplifycfg to recompute branch weights when merging some branches, and
Nick Lewycky [Tue, 27 Dec 2011 04:31:52 +0000 (04:31 +0000)]
Teach simplifycfg to recompute branch weights when merging some branches, and
to discard weights when appropriate. Still more to do (and a new TODO), but
it's a start!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147286 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUsing Inst->setMetadata(..., NULL) should be safe to remove metadata even when
Nick Lewycky [Tue, 27 Dec 2011 01:17:40 +0000 (01:17 +0000)]
Using Inst->setMetadata(..., NULL) should be safe to remove metadata even when
there is non of that type to remove. This fixes a crasher in the particular
case where the instruction has metadata but no metadata storage in the context
(this is only possible if the instruction has !dbg but no other metadata info).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147285 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix warning.
Rafael Espindola [Mon, 26 Dec 2011 23:12:42 +0000 (23:12 +0000)]
Fix warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147284 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure DAGCombiner doesn't introduce multiple loads from the same memory location...
Eli Friedman [Mon, 26 Dec 2011 22:49:32 +0000 (22:49 +0000)]
Make sure DAGCombiner doesn't introduce multiple loads from the same memory location.  PR10747, part 2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate the branch weight metadata when reversing the order of a branch.
Nick Lewycky [Mon, 26 Dec 2011 20:54:14 +0000 (20:54 +0000)]
Update the branch weight metadata when reversing the order of a branch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSort includes, canonicalize whitespace, fix typos. No functionality change.
Nick Lewycky [Mon, 26 Dec 2011 20:37:40 +0000 (20:37 +0000)]
Sort includes, canonicalize whitespace, fix typos. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147279 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate the LangRef documentation: the codegen does support this instruction.
Nadav Rotem [Sun, 25 Dec 2011 21:32:35 +0000 (21:32 +0000)]
Update the LangRef documentation: the codegen does support this instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147274 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a typo in the widening of vectors in PromoteIntRes. Patch by Shemer Anat.
Nadav Rotem [Sun, 25 Dec 2011 20:01:38 +0000 (20:01 +0000)]
Fix a typo in the widening of vectors in PromoteIntRes. Patch by Shemer Anat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147272 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSparc: Implement emitFrameIndexDebugValue and getDebugValue Location hooks.
Venkatraman Govindaraju [Sun, 25 Dec 2011 18:50:24 +0000 (18:50 +0000)]
Sparc: Implement emitFrameIndexDebugValue and getDebugValue Location hooks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147269 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd braces to remove silly warning.
Bill Wendling [Sun, 25 Dec 2011 06:56:22 +0000 (06:56 +0000)]
Add braces to remove silly warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147264 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused variables.
Rafael Espindola [Sun, 25 Dec 2011 01:20:19 +0000 (01:20 +0000)]
Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147261 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd an explicit test that we now fold cttz.i32(..., true) >> 5 -> 0.
Chandler Carruth [Sat, 24 Dec 2011 22:34:15 +0000 (22:34 +0000)]
Add an explicit test that we now fold cttz.i32(..., true) >> 5 -> 0.
This is a result of Benjamin's work on ValueTracking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147259 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff x is...
Benjamin Kramer [Sat, 24 Dec 2011 17:31:53 +0000 (17:31 +0000)]
InstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff x is smaller than 2^n and it fuses with a following add.

This was intended to undo the sub canonicalization in cases where it's not profitable, but it also
finds some cases on it's own.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147256 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComputeMaskedBits: Make knownzero computation more aggressive for ctlz with undef...
Benjamin Kramer [Sat, 24 Dec 2011 17:31:46 +0000 (17:31 +0000)]
ComputeMaskedBits: Make knownzero computation more aggressive for ctlz with undef zero.

unsigned foo(unsigned x) { return 31 - __builtin_clz(x); }
now compiles into a single "bsrl" instruction on x86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be smaller...
Benjamin Kramer [Sat, 24 Dec 2011 17:31:38 +0000 (17:31 +0000)]
InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be smaller than 2^n.

This has the obvious advantage of being commutable and is always a win on x86 because
const - x wastes a register there. On less weird architectures this may lead to
a regression because other arithmetic doesn't fuse with it anymore. I'll address that
problem in a followup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147254 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSection relative fixups are a coff concept, not a x86 one. Replace the
Rafael Espindola [Sat, 24 Dec 2011 14:47:52 +0000 (14:47 +0000)]
Section relative fixups are a coff concept, not a x86 one. Replace the
x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147252 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse standard promotion for i8 CTTZ nodes and i8 CTLZ nodes when the
Chandler Carruth [Sat, 24 Dec 2011 12:12:34 +0000 (12:12 +0000)]
Use standard promotion for i8 CTTZ nodes and i8 CTLZ nodes when the
LZCNT instructions are available. Force promotion to i32 to get
a smaller encoding since the fix-ups necessary are just as complex for
either promoted type

We can't do standard promotion for CTLZ when lowering through BSR
because it results in poor code surrounding the 'xor' at the end of this
instruction. Essentially, if we promote the entire CTLZ node to i32, we
end up doing the xor on a 32-bit CTLZ implementation, and then
subtracting appropriately to get back to an i8 value. Instead, our
custom logic just uses the knowledge of the incoming size to compute
a perfect xor. I'd love to know of a way to fix this, but so far I'm
drawing a blank. I suspect the legalizer could be more clever and/or it
could collude with the DAG combiner, but how... ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147251 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd systematic testing for cttz as well, and fix the bug I spotted by
Chandler Carruth [Sat, 24 Dec 2011 11:46:10 +0000 (11:46 +0000)]
Add systematic testing for cttz as well, and fix the bug I spotted by
inspection earlier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147250 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd i8 and i64 testing for ctlz on x86. Also simplify the i16 test.
Chandler Carruth [Sat, 24 Dec 2011 11:26:59 +0000 (11:26 +0000)]
Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147249 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy up this rather crufty test. Put the declarations at the top to make
Chandler Carruth [Sat, 24 Dec 2011 11:26:57 +0000 (11:26 +0000)]
Tidy up this rather crufty test. Put the declarations at the top to make
my C-brain happy. Remove the unnecessary bits of pedantic IR fluff like
nounwind. Remove stray uses comments. Name things semantically rather
than tN so that adding a new test in the middle doesn't cause pain, and
so that new tests can be grouped semantically.

This exposes how little systematic testing is going on here. I noticed
this by finding several bugs via inspection and wondering why this test
wasn't catching any of them. =[

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147248 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChandler fixed this.
Benjamin Kramer [Sat, 24 Dec 2011 11:23:32 +0000 (11:23 +0000)]
Chandler fixed this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147247 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoExpand more when we have a nice 'tzcnt' instruction, to avoid generating
Chandler Carruth [Sat, 24 Dec 2011 11:11:38 +0000 (11:11 +0000)]
Expand more when we have a nice 'tzcnt' instruction, to avoid generating
'bsf' instructions here.

This one is actually debatable to my eyes. It's not clear that any chip
implementing 'tzcnt' would have a slow 'bsf' for any reason, and unless
EFLAGS or a zero input matters, 'tzcnt' is just a longer encoding.
Still, this restores the old behavior with 'tzcnt' enabled for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147246 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy up some of these tests.
Chandler Carruth [Sat, 24 Dec 2011 11:11:36 +0000 (11:11 +0000)]
Tidy up some of these tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147245 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch the lowering of CTLZ_ZERO_UNDEF from a .td pattern back to the
Chandler Carruth [Sat, 24 Dec 2011 10:55:54 +0000 (10:55 +0000)]
Switch the lowering of CTLZ_ZERO_UNDEF from a .td pattern back to the
X86ISelLowering C++ code. Because this is lowered via an xor wrapped
around a bsr, we want the dagcombine which runs after isel lowering to
have a chance to clean things up. In particular, it is very common to
see code which looks like:

  (sizeof(x)*8 - 1) ^ __builtin_clz(x)

Which is trying to compute the most significant bit of 'x'. That's
actually the value computed directly by the 'bsr' instruction, but if we
match it too late, we'll get completely redundant xor instructions.

The more naive code for the above (subtracting rather than using an xor)
still isn't handled correctly due to the dagcombine getting confused.

Also, while here fix an issue spotted by inspection: we should have been
expanding the zero-undef variants to the normal variants when there is
an 'lzcnt' instruction. Do so, and test for this. We don't want to
generate unnecessary 'bsr' instructions.

These two changes fix some regressions in encoding and decoding
benchmarks. However, there is still a *lot* to be improve on in this
type of code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147244 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup this test a bit, sorting things and grouping them more clearly.
Chandler Carruth [Sat, 24 Dec 2011 10:55:42 +0000 (10:55 +0000)]
Cleanup this test a bit, sorting things and grouping them more clearly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147243 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix Comments.
Jakob Stoklund Olesen [Sat, 24 Dec 2011 04:17:01 +0000 (04:17 +0000)]
Fix Comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147238 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd MachineMemOperands to instructions generated in storeRegToStackSlot or
Akira Hatanaka [Sat, 24 Dec 2011 03:11:18 +0000 (03:11 +0000)]
Add MachineMemOperands to instructions generated in storeRegToStackSlot or
loadRegFromStackSlot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147235 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDetect unaligned loads/stores that have been added for Mips64 support.
Akira Hatanaka [Sat, 24 Dec 2011 03:07:37 +0000 (03:07 +0000)]
Detect unaligned loads/stores that have been added for Mips64 support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147234 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest case for r147232.
Akira Hatanaka [Sat, 24 Dec 2011 03:05:43 +0000 (03:05 +0000)]
Test case for r147232.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147233 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIf target ABI is N64, LEA should be daddiu.
Akira Hatanaka [Sat, 24 Dec 2011 02:59:27 +0000 (02:59 +0000)]
If target ABI is N64, LEA should be daddiu.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147232 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove x86 specific bits of the COFF writer to lib/Target/X86.
Rafael Espindola [Sat, 24 Dec 2011 02:14:02 +0000 (02:14 +0000)]
Move x86 specific bits of the COFF writer to lib/Target/X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147231 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDefine trivial destructor inline.
Rafael Espindola [Sat, 24 Dec 2011 01:53:13 +0000 (01:53 +0000)]
Define trivial destructor inline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147230 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake GetRelocType pure virtual.
Rafael Espindola [Sat, 24 Dec 2011 01:36:25 +0000 (01:36 +0000)]
Make GetRelocType pure virtual.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147229 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix typo "infinte".
Nick Lewycky [Fri, 23 Dec 2011 23:49:25 +0000 (23:49 +0000)]
Fix typo "infinte".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147226 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove this test from date-name to feature-name, and port it to FileCheck.
Nick Lewycky [Fri, 23 Dec 2011 18:41:31 +0000 (18:41 +0000)]
Move this test from date-name to feature-name, and port it to FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147223 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen not destroying the source, the linker is not remapping the types. Added support
Mon P Wang [Fri, 23 Dec 2011 02:18:32 +0000 (02:18 +0000)]
When not destroying the source, the linker is not remapping the types. Added support
to CloneFunctionInto to allow remapping for this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147217 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse 'check_symbol_exists' instead of 'check_function_exists' for finding isatty....
Ted Kremenek [Fri, 23 Dec 2011 01:31:45 +0000 (01:31 +0000)]
Use 'check_symbol_exists' instead of 'check_function_exists' for finding isatty.  This change allows Xcode generated projects to have HAVE_ISATTY to be properly defined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147215 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoExperimental support for aligned NEON spills.
Jakob Stoklund Olesen [Fri, 23 Dec 2011 00:36:18 +0000 (00:36 +0000)]
Experimental support for aligned NEON spills.

ARM targets with NEON units have access to aligned vector loads and
stores that are potentially faster than unaligned operations.

Add support for spilling the callee-saved NEON registers to an aligned
stack area using 16-byte aligned NEON loads and store.

This feature is off by default, controlled by an -align-neon-spills
command line option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147211 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd variants of the dispatchsetup pseudo for Thumb and !VFP. <rdar://10620138>
Bob Wilson [Thu, 22 Dec 2011 23:39:48 +0000 (23:39 +0000)]
Add variants of the dispatchsetup pseudo for Thumb and !VFP. <rdar://10620138>

My change r146949 added register clobbers to the eh_sjlj_dispatchsetup pseudo
instruction, but on Thumb1 some of those registers cannot be used.  This
caused massive failures on the testsuite when compiling for Thumb1.  While
fixing that, I noticed that the eh_sjlj_setjmp instruction has a "nofp"
variant, and I realized that dispatchsetup needs the same thing, so I have
added that as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147204 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTableGen: add a comment
Dylan Noblesmith [Thu, 22 Dec 2011 23:16:09 +0000 (23:16 +0000)]
TableGen: add a comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147199 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotry to fix MSVC build
Dylan Noblesmith [Thu, 22 Dec 2011 23:08:39 +0000 (23:08 +0000)]
try to fix MSVC build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147198 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agodrop unneeded config.h includes
Dylan Noblesmith [Thu, 22 Dec 2011 23:04:07 +0000 (23:04 +0000)]
drop unneeded config.h includes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147197 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttempt #2 to fix mingw crossbuild. This time with more ugly hacks!
Benjamin Kramer [Thu, 22 Dec 2011 22:50:44 +0000 (22:50 +0000)]
Attempt #2 to fix mingw crossbuild. This time with more ugly hacks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147196 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix 80-column violations.
Chad Rosier [Thu, 22 Dec 2011 22:35:21 +0000 (22:35 +0000)]
Fix 80-column violations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147192 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake the -fvisibility-inlines-hidden check more thorough in a hopeless attempt to...
Benjamin Kramer [Thu, 22 Dec 2011 22:25:26 +0000 (22:25 +0000)]
Make the -fvisibility-inlines-hidden check more thorough in a hopeless attempt to fix mingw cross-compiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147191 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove all the dependencies on X86FixupKinds.h to a single method in preparation
Rafael Espindola [Thu, 22 Dec 2011 22:21:47 +0000 (22:21 +0000)]
Move all the dependencies on X86FixupKinds.h to a single method in preparation
to moving it to lib/Target/X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147190 91177308-0d34-0410-b5e6-96231b3b80d8