Eli Friedman
fefe0d07ea
Don't try to create "store atomic" instructions of non-integer types; they aren't supported at the moment. PR12040.
...
llvm-svn: 152891
2012-03-16 01:48:04 +00:00
James Molloy
4813fc8ed6
Fix codegen for vld{3,4}_dup intrinsics.
...
Patch by Silviu Baranga!
llvm-svn: 152788
2012-03-15 09:12:01 +00:00
Chris Lattner
aaa18fad7d
add a testcase for PR12094 and fix a crash on pointer to incomplete type,
...
reported by Richard Smith.
llvm-svn: 151993
2012-03-04 00:52:12 +00:00
Jay Foad
b0f3344b10
PR12094: Set the alignment of memory intrinsic instructions based on the
...
types of the pointer arguments.
llvm-svn: 151927
2012-03-02 18:34:30 +00:00
Bill Wendling
f1a3fcac0d
Use an ArrayRef when we can instead of passing in a SmallVectorImpl reference.
...
llvm-svn: 151150
2012-02-22 09:30:11 +00:00
Chandler Carruth
a2a5410e6d
Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
...
match the behavior of GCC. Also add a test for these intrinsics, which
apparently have *zero* tests. =[ Not surprisingly, Clang crashed when
compiling these.
Fix the bug in CodeGen where we failed to bitcast the argument type to
x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the
new 3dnow-builtins.c test.
This is one issue impacting the efforts to get Clang to emulate the
Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made
available there.
llvm-svn: 150948
2012-02-20 07:35:45 +00:00
Chris Lattner
ece0409a1a
simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
...
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
Bob Wilson
49708d41a6
Preserve alignment for Neon vld1_lane/dup and vst1_lane intrinsics.
...
We had been generating load/store instructions with the default alignment
for the vector element type, even when the pointer argument had less alignment.
<rdar://problem/10538555>
llvm-svn: 149794
2012-02-04 23:58:08 +00:00
Craig Topper
2962e7b656
Remove long dead code for handling vector shift by immediate builtins.
...
llvm-svn: 149237
2012-01-30 08:51:36 +00:00
Craig Topper
2c82f9ecf8
Remove custom handling for cmpsd/cmpss/cmppd/cmpps builtins. The builtins are now in IntrinsicsX86.td.
...
llvm-svn: 149235
2012-01-30 08:38:42 +00:00
Craig Topper
d6d3a05b4f
Cleanup 3dnow builtin handling. Most of them were already handled by LLVM connecting intrinsics and builtins in IntrinsicsX86.td.
...
llvm-svn: 149233
2012-01-30 08:18:19 +00:00
Benjamin Kramer
1412816686
Make the __builtin_c[lt]zs builtins target independent.
...
There is really no reason to have these only available on x86. It's
just __builtin_c[tl]z for shorts.
Modernize the test while at it.
llvm-svn: 149183
2012-01-28 18:42:57 +00:00
Bob Wilson
a7a61e2701
Make clz/ctz builtins defined for zero on ARM targets. rdar://10732455
...
ARM supports clz and ctz directly and both operations have well-defined
results for zero. There is no disadvantage in performance to using the
defined-at-zero versions of llvm.ctlz/cttz intrinsics. We're running into
ARM-specific code written with the assumption that __builtin_clz(0) == 32,
even though that value is technically undefined. The code is failing now
because of llvm optimizations that are taking advantage of the undef
behavior (specifically svn r147255). There's nothing wrong with that
optimization on x86 where any incorrect assumptions about __builtin_clz(0)
will quickly be exposed. For ARM, though, optimizations based on that undef
behavior are likely to cause subtle bugs. Other targets with defined-at-zero
clz/ctz support may want to override the default behavior as well.
llvm-svn: 149086
2012-01-26 22:14:27 +00:00
Chris Lattner
2d6b7b91b9
reapply r148902:
...
"use the new ConstantVector::getSplat method where it makes sense."
Also simplify a bunch of code to use the Builder->getInt32 instead
of doing it the hard and ugly way. Much more progress could be made
here, but I don't plan to do it.
llvm-svn: 148926
2012-01-25 05:34:41 +00:00
Argyrios Kyrtzidis
5a25297c5e
Revert 148902 which was part of 148901 which was reverted in r148906.
...
Original log:
use the new ConstantVector::getSplat method where it makes sense.
llvm-svn: 148907
2012-01-25 02:58:12 +00:00
Chris Lattner
c558d7d176
use the new ConstantVector::getSplat method where it makes sense.
...
llvm-svn: 148902
2012-01-25 02:06:10 +00:00
David Blaikie
e4d798f078
More dead code removal (using -Wunreachable-code)
...
llvm-svn: 148577
2012-01-20 21:50:17 +00:00
Eli Friedman
65499b45f0
Add __builtin_labs and __builtin_llabs, to complete the set of __builtin_*abs. Patch by Ruben Van Boxem.
...
llvm-svn: 148340
2012-01-17 22:11:30 +00:00
David Blaikie
f47fa304a4
Remove unnecessary default cases in switches over enums.
...
This allows -Wswitch-enum to find switches that need updating when these enums are modified.
llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Eli Friedman
df88c54f8d
Revert r147655; it's breaking the compiler_rt build on OSX.
...
llvm-svn: 147677
2012-01-06 20:03:09 +00:00
David Chisnall
9217435a33
If we are compiling with -fno-builtin then don't do constant folding of
...
builtins.
This fixes PR11711.
llvm-svn: 147655
2012-01-06 12:20:19 +00:00
Richard Smith
5fab0c9e1a
Small refactoring and simplification of constant evaluation and some of its
...
clients. No functionality change.
llvm-svn: 147318
2011-12-28 19:48:30 +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
94aba2c260
More AVX2 intrinsic support including saturating add/sub and palignr.
...
llvm-svn: 146857
2011-12-19 07:03:25 +00:00
Tony Linthicum
76329bf83f
Hexagon backend support
...
llvm-svn: 146413
2011-12-12 21:14:55 +00:00
Chandler Carruth
a31b95cacf
Update Clang to emit the new form of llvm.cttz and llvm.ctlz intrinsics,
...
setting the is_zero_undef flag appropriately to true as that matches the
semantics of these GCC builtins.
This is the Clang side of r146357 in LLVM.
llvm-svn: 146358
2011-12-12 04:28:35 +00:00
NAKAMURA Takumi
dabda6b839
lib/CodeGen/CGBuiltin.cpp: Tweak the identifier "Type" to appease msvc.
...
llvm-svn: 144065
2011-11-08 03:27:04 +00:00
Bob Wilson
98bc98caa8
Clean up type flags for overloaded Neon builtins. No functional change.
...
This patch just adds a simple NeonTypeFlags class to replace the various
hardcoded constants that had been used until now. Unfortunately I couldn't
figure out a good way to avoid duplicating that class between clang and
TableGen, but since it's small and rarely changes, that's not so bad.
llvm-svn: 144054
2011-11-08 01:16:11 +00:00
Richard Smith
7b553f1b19
Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
...
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.
llvm-svn: 143263
2011-10-29 00:50:52 +00:00
Eli Friedman
df14b3a837
Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
...
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
Richard Smith
caf3390d44
Constant expression evaluation refactoring:
...
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.
llvm-svn: 141561
2011-10-10 18:28:20 +00:00
Eli Friedman
c8b57f6683
llvm.memory.barrier is going away; remove the wrapper intrinsic __builtin_llvm_memory_barrier.
...
__atomic_thread_fence will be landing soon as a replacement, wrapping around the new fence instruction.
llvm-svn: 141332
2011-10-06 23:12:03 +00:00
Benjamin Kramer
76399eb2ad
de-tmpify clang.
...
llvm-svn: 140637
2011-09-27 21:06:10 +00:00
David Blaikie
83d382b1ca
Switch assert(0/false) llvm_unreachable.
...
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Eli Friedman
2dadd3ebee
Fix comment.
...
llvm-svn: 139678
2011-09-14 00:52:45 +00:00
John McCall
30e4efd458
Correctly generate IR for casted "builtin" functions, where
...
the builtin is really just a predefined declaration. These are
totally valid to cast.
llvm-svn: 139657
2011-09-13 23:05:03 +00:00
Eli Friedman
84d2812111
Re-commit r139643.
...
Make clang use Acquire loads and Release stores where necessary.
llvm-svn: 139650
2011-09-13 22:21:56 +00:00
Eli Friedman
acca089617
Revert r139643 while I look into it; it's breaking selfhost.
...
llvm-svn: 139648
2011-09-13 22:08:16 +00:00
Eli Friedman
f92b2e0714
Make clang use Acquire loads and Release stores where necessary.
...
llvm-svn: 139643
2011-09-13 21:31:32 +00:00
Julien Lerouge
e0d5fad37b
Remove trailing } in comment.
...
llvm-svn: 139424
2011-09-09 22:46:39 +00:00
Julien Lerouge
5a6b6987dc
Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
...
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.
llvm-svn: 139423
2011-09-09 22:41:49 +00:00
Eli Friedman
e9f8113ec4
Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything.
...
There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now.
I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier. I would appreciate hearing from anyone who is using this intrinsic.
llvm-svn: 139216
2011-09-07 01:41:24 +00:00
Ted Kremenek
c14efa7122
Fix a handful of dead stores found by Clang's static analyzer. There's a bunch of others I haven't touched.
...
llvm-svn: 137867
2011-08-17 21:04:19 +00:00
Bob Wilson
445c24f8f0
Move handling of vget_lane/vset_lane before the code that checks the type.
...
Unlike most of the other Neon intrinsics, these are not overloaded and do not
have the extra argument that specifies the vector type. This has not been
fatal because the lane number operand is supposed to be an ICE and so that
value has harmlessly been used as the type identifier. Radar 9901281.
llvm-svn: 137550
2011-08-13 05:03:46 +00:00
Jay Foad
5709f7c5f7
Remove some unnecessary single element array temporaries.
...
llvm-svn: 136461
2011-07-29 13:56:53 +00:00
Frits van Bommel
ede0dc6dda
Shorten some expressions by using ArrayRef::slice().
...
llvm-svn: 135910
2011-07-25 15:13:01 +00:00
Chris Lattner
0e62c1cc0b
remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
...
them into the clang namespace.
llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Frits van Bommel
717d7edd3e
Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
...
Mostly mechanical with some manual reformatting.
llvm-svn: 135390
2011-07-18 12:00:32 +00:00
Chris Lattner
2192fe50da
de-constify llvm::Type, patch by David Blaikie!
...
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Jay Foad
5bd375a6cc
Convert CallInst and InvokeInst APIs to use ArrayRef.
...
llvm-svn: 135265
2011-07-15 08:37:34 +00:00
Benjamin Kramer
8d375cef55
Change intrinsic getter to take an ArrayRef, now that the underlying function in LLVM does.
...
llvm-svn: 135155
2011-07-14 17:45:50 +00:00
Chris Lattner
a5f58b05e8
clang side to match the LLVM IR type system rewrite patch.
...
llvm-svn: 134831
2011-07-09 17:41:47 +00:00
Jakub Staszak
d2cf2cbae9
Introduce __builtin_expect() intrinsic support.
...
llvm-svn: 134761
2011-07-08 22:45:14 +00:00
Cameron Zwarich
ae7bc98710
Add codegen support for the fma/fmal/fmaf builtins.
...
llvm-svn: 134743
2011-07-08 21:39:34 +00:00
Bob Wilson
6bc2164d2a
Revert "Shorten some ARM builtin names by removing unnecessary "neon" prefix."
...
Sorry, this was a bad idea. Within clang these builtins are in a separate
"ARM" namespace, but the actual builtin names should clearly distinguish tha
they are target specific.
llvm-svn: 133833
2011-06-24 22:13:26 +00:00
Bob Wilson
932e5b5d52
Shorten some ARM builtin names by removing unnecessary "neon" prefix.
...
llvm-svn: 133826
2011-06-24 21:32:46 +00:00
Chris Lattner
845511fe1c
update for api change.
...
llvm-svn: 133365
2011-06-18 22:49:11 +00:00
Bruno Cardoso Lopes
3b0297a98c
Update the prefetch intrinsic usage. Now the last argument tells codegen
...
whether it's a data or instruction cache access.
llvm-svn: 132977
2011-06-14 05:00:30 +00:00
Benjamin Kramer
df1fb13a5c
Eliminate temporary argument vectors.
...
llvm-svn: 132260
2011-05-28 14:26:31 +00:00
Bruno Cardoso Lopes
fe73374d7a
Add support for ARM ldrexd/strexd builtins
...
llvm-svn: 132249
2011-05-28 04:11:33 +00:00
Bill Wendling
bb455154a1
Remove the 'unaligned load' builtins now that they're no longer used in the *mmintrin.h files.
...
llvm-svn: 131300
2011-05-13 18:52:28 +00:00
Bill Wendling
e106c34817
LLVM doesn't always optimize away the four loads from this:
...
(__m128){ p[0], p[1], p[2], p[3] }
which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>
llvm-svn: 131237
2011-05-12 19:02:15 +00:00
Bill Wendling
6869b6abf8
Simplification noticed by Chris.
...
llvm-svn: 130864
2011-05-04 20:28:12 +00:00
Bill Wendling
5f9150b5b1
Convert the non-temporal store builtins to LLVM-native IR.
...
llvm-svn: 130830
2011-05-04 02:40:38 +00:00
Fariborz Jahanian
24ac1599fc
Generalize case for built-in expressions having
...
side-effect to generate their ir. Not just for
__builtin_expect. // rdar://9330105
llvm-svn: 130172
2011-04-25 23:10:07 +00:00
Fariborz Jahanian
5a866c0bf2
Ir-gen the side-effect(s) when __builtin_expect is
...
constant-folded. // rdar://9330105
llvm-svn: 130163
2011-04-25 22:30:02 +00:00
Chris Lattner
54fd1a1ad3
fix a crash on code that uses the result value of __builtin___memcpy_chk.
...
llvm-svn: 129892
2011-04-20 23:14:50 +00:00
Chris Lattner
30107ed600
fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
...
are trivial. This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.
This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0
llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Michael J. Spencer
6826eb816a
Add 3DNow! Intrinsics.
...
llvm-svn: 129570
2011-04-15 15:07:13 +00:00
Bill Wendling
a865185ad6
Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
...
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Bill Wendling
88ae43772a
It looks like the FreeBSD buildbot needs this for the builtins-x86.c test.
...
llvm-svn: 129433
2011-04-13 10:02:54 +00:00
Bill Wendling
b9c9e34cb3
Just use a native "load" instead of translating the builtin later. Clang can
...
take it!
I wasn't able to get __builtin_ia32_loaddqu to transform into an unaligned
load...I'll have to look into it further.
llvm-svn: 129427
2011-04-13 05:58:17 +00:00
Bill Wendling
3137d3cb49
Convert the unaligned load builtins to the first-class versions.
...
llvm-svn: 129420
2011-04-13 00:36:37 +00:00
Chris Lattner
9cb59fa834
add a __sync_swap builtin to fill out the rest of the __sync builtins.
...
Patch by Dave Zarzycki!
llvm-svn: 129189
2011-04-09 03:57:26 +00:00
Matt Beaumont-Gay
873c6dd875
Oops, prefer C-style cast here
...
llvm-svn: 128607
2011-03-31 01:56:27 +00:00
Matt Beaumont-Gay
a25fce8e9e
Silence GCC warning about differing types on the branches of a conditional expression
...
llvm-svn: 128605
2011-03-31 01:43:22 +00:00
Bob Wilson
7201af3914
Use intrinsics for Neon vmull operations. Radar 9208957.
...
llvm-svn: 128590
2011-03-31 00:09:00 +00:00
Jay Foad
20c0f02cc5
Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
...
PHINode::Create() giving the (known or expected) number of operands.
llvm-svn: 128538
2011-03-30 11:28:58 +00:00
Jay Foad
27e20c3c58
(Almost) always call reserveOperandSpace() on newly created PHINodes.
...
llvm-svn: 128534
2011-03-30 11:19:06 +00:00
Eli Friedman
b4d3c99929
Make sure we aggressively attach nounwind (etc.) to calls to library
...
functions of the form __builtin_XXX.
llvm-svn: 128198
2011-03-24 05:09:45 +00:00
Eric Christopher
cf5e83b471
__clear_cache() is varargs and people will occasionally write it without
...
arguments. Process only the arguments that people write, but process
all of them.
Fixes rdar://8900346
llvm-svn: 127616
2011-03-14 20:30:34 +00:00
Chris Lattner
91c08ad14a
update for ConstantVector API change.
...
llvm-svn: 125538
2011-02-15 00:14:06 +00:00
Chris Lattner
dd68bd0a65
revert my ConstantVector patch, it seems to have made the llvm-gcc
...
builders unhappy.
llvm-svn: 125505
2011-02-14 18:16:09 +00:00
Chris Lattner
2d9a7672db
update for ConstantVector::get API change.
...
llvm-svn: 125488
2011-02-14 07:55:40 +00:00
John McCall
ad7c5c1657
Reorganize CodeGen{Function,Module} to eliminate the unfortunate
...
Block{Function,Module} base class. Minor other refactorings.
Fixed a few address-space bugs while I was there.
llvm-svn: 125085
2011-02-08 08:22:06 +00:00
Ted Kremenek
582a0999fb
Null initialize a few variables flagged by
...
clang's -Wuninitialized-experimental warning.
While these don't look like real bugs, clang's
-Wuninitialized-experimental analysis is stricter
than GCC's, and these fixes have the benefit
of being general nice cleanups.
llvm-svn: 124072
2011-01-23 17:04:59 +00:00
John McCall
20f6ab828a
Fix a latent bug where, after emitting an expression statement, we would
...
delete the block we began emitting into if it had no predecessors. We never
want to do this, because there are several valid cases during statement
emission where an existing block has no known predecessors but will acquire
some later. The case in my test case doesn't inherently fall into this
category, because we could safely emit the case-range code before the statement
body, but there are examples with labels that can't be fallen into
that would also demonstrate this bug.
rdar://problem/8837067
llvm-svn: 123303
2011-01-12 03:41:02 +00:00
Benjamin Kramer
39f987ffd0
Make a helper function static.
...
llvm-svn: 123118
2011-01-09 13:21:33 +00:00
Benjamin Kramer
acc6b4e2fd
Simplify mem{cpy, move, set} creation with IRBuilder.
...
llvm-svn: 122634
2010-12-30 00:13:21 +00:00
Bob Wilson
63fbbc6ef8
Implement builtins for Neon half-precision float conversions.
...
Also tweak the VCVT_F32_F16 entry in arm_neon.td to be more consistent with
the other floating-point conversion builtins. Radar 8068427.
llvm-svn: 121916
2010-12-15 23:36:44 +00:00
Bob Wilson
546b691c73
Add missing switch case for the quad-register version of the Neon vmul builtin.
...
llvm-svn: 121595
2010-12-10 23:09:09 +00:00
Bob Wilson
0348af667a
Fix clang crashes on Neon vld[234]_dup intrinsics with 64-bit element types.
...
The 64-bit element vectors need to be handled as a special case.
llvm-svn: 121592
2010-12-10 22:54:58 +00:00
Bob Wilson
4c4a00a10b
Add missing switch case to handle builtin for Neon vqnegq.
...
llvm-svn: 121468
2010-12-10 06:26:19 +00:00
Bob Wilson
d1767c5c15
LLVM's intrinsics for vpaddl and vpadal have 2 overloaded types.
...
Clang was only specifying the overloaded result type. PR8483.
llvm-svn: 121464
2010-12-10 05:51:07 +00:00
Bob Wilson
571c907cdf
Neon compare absolute LLVM intrinsics are not overloaded. PR8484.
...
llvm-svn: 121447
2010-12-10 01:11:38 +00:00
Bob Wilson
482afae812
Stop using builtins for the "_lane" variants of saturating multiply intrinsics.
...
Remove the "splat" parameter from the EmitNeonCall function, since it is no
longer needed.
llvm-svn: 121300
2010-12-08 22:37:56 +00:00
Bob Wilson
b038120094
Stop using clang builtins for Neon vabdl and vabal intrinsics.
...
llvm-svn: 121288
2010-12-08 21:39:47 +00:00
Bob Wilson
7d66df9c33
Stop using clang builtins for Neon vaba intrinsics.
...
llvm-svn: 121277
2010-12-08 20:09:54 +00:00
Chandler Carruth
8005adf031
Silence an unused variable warning.
...
llvm-svn: 121221
2010-12-08 01:29:17 +00:00
Bob Wilson
8811c3a72e
Stop using clang builtins for Neon vadd[lw] and vsub[lw] intrinsics.
...
llvm-svn: 121214
2010-12-08 00:14:43 +00:00