Commit Graph

119279 Commits

Author SHA1 Message Date
Eli Friedman e96286cdf2 Make sure DAGCombiner doesn't introduce multiple loads from the same memory location. PR10747, part 2.
llvm-svn: 147283
2011-12-26 22:49:32 +00:00
Eli Friedman 2b081c2c9e Partially revert r147195; lib/Basic/Version.cpp conditionally depends on config.h.
llvm-svn: 147282
2011-12-26 22:43:17 +00:00
Rafael Espindola cde2c8f7d2 Delay checking of typedefs of dependent types. Fixes PR11630.
llvm-svn: 147281
2011-12-26 22:42:47 +00:00
Nick Lewycky 8d302df4a4 Update the branch weight metadata when reversing the order of a branch.
llvm-svn: 147280
2011-12-26 20:54:14 +00:00
Nick Lewycky e87d54c817 Sort includes, canonicalize whitespace, fix typos. No functionality change.
llvm-svn: 147279
2011-12-26 20:37:40 +00:00
Dylan Noblesmith 68207c0b26 driver: fix unused variable warning
from r147218.

llvm-svn: 147278
2011-12-26 19:29:47 +00:00
Benjamin Kramer eed4f2a6c5 Fix potential use after free.
llvm-svn: 147277
2011-12-26 14:18:37 +00:00
NAKAMURA Takumi 9a3f299f0e clang/lib/Headers/CMakeLists.txt: Unbreak cmake build to add bmi2intrin.h since r147275.
llvm-svn: 147276
2011-12-26 03:20:06 +00:00
Craig Topper c334dd68a7 Add BMI2 intrinsics.
llvm-svn: 147275
2011-12-26 02:31:10 +00:00
Nadav Rotem 4c4d254f61 Update the LangRef documentation: the codegen does support this instruction.
llvm-svn: 147274
2011-12-25 21:32:35 +00:00
Richard Smith f0215fe898 Fix constexpr handling to allow 'extern constexpr' variable declarations. We no
longer have access to the source locations we need to produce the
'replace constexpr with const' fixits, so they're gone for now.

llvm-svn: 147273
2011-12-25 21:17:58 +00:00
Nadav Rotem c1faeac410 Fix a typo in the widening of vectors in PromoteIntRes. Patch by Shemer Anat.
llvm-svn: 147272
2011-12-25 20:01:38 +00:00
Richard Smith 771c4a1775 constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.

llvm-svn: 147271
2011-12-25 20:00:17 +00:00
Venkatraman Govindaraju 1fc8263b4d Sparc: Implement emitFrameIndexDebugValue and getDebugValue Location hooks.
llvm-svn: 147269
2011-12-25 18:50:24 +00:00
Craig Topper 03348d09e3 Change LZCNT and BMI tests to check IR instead of X86 assembly.
llvm-svn: 147267
2011-12-25 15:20:31 +00:00
NAKAMURA Takumi dceeeb8918 lib/Headers/CMakeLists.txt: Fix cmake build since r147263, for two missing headers.
llvm-svn: 147266
2011-12-25 12:47:46 +00:00
Craig Topper a06d4a1c40 Add the rest of the BMI intrinsics.
llvm-svn: 147265
2011-12-25 07:27:12 +00:00
Bill Wendling 2990ec6e92 Add braces to remove silly warning.
llvm-svn: 147264
2011-12-25 06:56:22 +00:00
Craig Topper f2855ade2b Add intrinsics for lzcnt and tzcnt instructions.
llvm-svn: 147263
2011-12-25 06:25:37 +00:00
Craig Topper 22967d4a61 Add BMI, BMI2, and LZCNT feature flags to enable adding intrinsics.
llvm-svn: 147262
2011-12-25 05:06:45 +00:00
Rafael Espindola 2d3dac3e87 Remove unused variables.
llvm-svn: 147261
2011-12-25 01:20:19 +00:00
Rafael Espindola 65e025cad5 Remove unused variables.
llvm-svn: 147260
2011-12-25 01:18:52 +00:00
Chandler Carruth 8b7e71ffd6 Add an explicit test that we now fold cttz.i32(..., true) >> 5 -> 0.
This is a result of Benjamin's work on ValueTracking.

llvm-svn: 147259
2011-12-24 22:34:15 +00:00
Richard Smith 966c1fb0c8 Always implicitly declare move assignment operations for dynamic classes, in
case they override virtual functions from a base class. Also fix -print-stats
counting of move assignment/construction.

llvm-svn: 147258
2011-12-24 21:56:24 +00:00
Benjamin Kramer b16bd77bd2 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.

llvm-svn: 147256
2011-12-24 17:31:53 +00:00
Benjamin Kramer 4ee5747fdd 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.

llvm-svn: 147255
2011-12-24 17:31:46 +00:00
Benjamin Kramer 010337c838 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.

llvm-svn: 147254
2011-12-24 17:31:38 +00:00
Craig Topper 175543ac78 Add last of the AVX2 intrinsics except for gather.
llvm-svn: 147253
2011-12-24 17:20:15 +00:00
Rafael Espindola a56ab0ede7 Section relative fixups are a coff concept, not a x86 one. Replace the
x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.

llvm-svn: 147252
2011-12-24 14:47:52 +00:00
Chandler Carruth a3d54fe0ae 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... ;]

llvm-svn: 147251
2011-12-24 12:12:34 +00:00
Chandler Carruth 38ce24455d Add systematic testing for cttz as well, and fix the bug I spotted by
inspection earlier.

llvm-svn: 147250
2011-12-24 11:46:10 +00:00
Chandler Carruth 103ca80f59 Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.
llvm-svn: 147249
2011-12-24 11:26:59 +00:00
Chandler Carruth 44cf07228b 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. =[

llvm-svn: 147248
2011-12-24 11:26:57 +00:00
Benjamin Kramer 767bbe48c1 Chandler fixed this.
llvm-svn: 147247
2011-12-24 11:23:32 +00:00
Chandler Carruth c9fcde2347 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.

llvm-svn: 147246
2011-12-24 11:11:38 +00:00
Chandler Carruth eeb3a1ce3e Tidy up some of these tests.
llvm-svn: 147245
2011-12-24 11:11:36 +00:00
Chandler Carruth 7e9453e916 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.

llvm-svn: 147244
2011-12-24 10:55:54 +00:00
Chandler Carruth 15075d4b19 Cleanup this test a bit, sorting things and grouping them more clearly.
llvm-svn: 147243
2011-12-24 10:55:42 +00:00
Craig Topper a9387739aa Add AVX2 permute intrinsics. Also add parentheses on some macro arguments in other intrinsic headers.
llvm-svn: 147242
2011-12-24 07:55:25 +00:00
Craig Topper 9f00948a82 Add AVX2 permute intrinsics. Also add parentheses on some macro arguments in other intrinsic headers.
llvm-svn: 147241
2011-12-24 07:55:14 +00:00
Craig Topper 9a01e58447 Add AVX2 intrinsics for FP vbroadcast, vbroadcasti128, and vpblendd.
llvm-svn: 147240
2011-12-24 05:19:47 +00:00
Craig Topper 9479895928 Add AVX2 intrinsics for FP vbroadcast, vbroadcasti128, and vpblendd.
llvm-svn: 147239
2011-12-24 05:19:29 +00:00
Jakob Stoklund Olesen 103318e9ea Fix Comments.
llvm-svn: 147238
2011-12-24 04:17:01 +00:00
Craig Topper a6fdbd1807 Intrinsics for AVX2 unpack instructions.
llvm-svn: 147237
2011-12-24 03:58:43 +00:00
Craig Topper f4bb952533 More AVX2 intrinsics for shift, psign, some shuffles, and psadbw.
llvm-svn: 147236
2011-12-24 03:28:57 +00:00
Akira Hatanaka 1cf7576707 Add MachineMemOperands to instructions generated in storeRegToStackSlot or
loadRegFromStackSlot. 

llvm-svn: 147235
2011-12-24 03:11:18 +00:00
Akira Hatanaka 6f54a46133 Detect unaligned loads/stores that have been added for Mips64 support.
llvm-svn: 147234
2011-12-24 03:07:37 +00:00
Akira Hatanaka 79329ce425 Test case for r147232.
llvm-svn: 147233
2011-12-24 03:05:43 +00:00
Akira Hatanaka 695d113adc If target ABI is N64, LEA should be daddiu.
llvm-svn: 147232
2011-12-24 02:59:27 +00:00
Rafael Espindola 908d2ed14e Move x86 specific bits of the COFF writer to lib/Target/X86.
llvm-svn: 147231
2011-12-24 02:14:02 +00:00