Dale Johannesen
54306fe499
Rename APFloat::convertToAPInt to bitcastToAPInt to
...
make it clearer what the function does. No functional
change.
llvm-svn: 57325
2008-10-09 18:53:47 +00:00
Nick Lewycky
ac5c7d514f
Try to fold each element of a vector. This is needed to maintain structural
...
equivalence.
llvm-svn: 55694
2008-09-03 06:48:55 +00:00
Nick Lewycky
f023db6444
Don't crash when trying to constant fold a vector with some elements that can't
...
be folded. Instead, fail to fold the entire vector.
We could also return a vector with some elements folded and some not. If anyone
thinks that's a better approach, please speak up!
llvm-svn: 55689
2008-09-03 05:54:33 +00:00
Chris Lattner
67136cff7b
Fix a case where vector comparison constant folding would cause an
...
infinite recursion. part of PR2529
llvm-svn: 53383
2008-07-10 00:29:28 +00:00
Chris Lattner
b69689e18b
elementwise comparison of vector constants was completely wrong. Fix
...
it for PR2529
llvm-svn: 53380
2008-07-10 00:08:17 +00:00
Chris Lattner
350e41760a
improve comment
...
llvm-svn: 53243
2008-07-08 18:47:38 +00:00
Chris Lattner
d137a08b0d
Fix three bugs:
...
1) evaluate [v]fcmp true/false with undefs to true or false instead
of undef.
2) fix vector comparisons with undef to return a vector result instead
of i1
3) fix vector comparisons with evaluatable results to return vector
true/false instead of i1 true/false (PR2529)
llvm-svn: 53220
2008-07-08 05:46:34 +00:00
Dan Gohman
3db11c2bd9
Constant folding for insertvalue and extractvalue.
...
llvm-svn: 51889
2008-06-03 00:15:20 +00:00
Nick Lewycky
eb185ca5e9
Revert constant-folding change that will miscompile in some cases.
...
llvm-svn: 51223
2008-05-17 19:00:05 +00:00
Nick Lewycky
79d681dddd
Unbreak the build.
...
llvm-svn: 51217
2008-05-17 09:05:22 +00:00
Nick Lewycky
1ba90bb69b
Constant fold inttoptr and ptrtoint.
...
llvm-svn: 51216
2008-05-17 09:03:26 +00:00
Dan Gohman
12fce7751b
IR support for extractvalue and insertvalue instructions. Also, begin
...
moving toward making structs and arrays first-class types.
llvm-svn: 51157
2008-05-15 19:50:34 +00:00
Gabor Greif
f6caff66a1
merge of use-diet branch to trunk
...
llvm-svn: 50943
2008-05-10 08:32:32 +00:00
Chris Lattner
912bec79ca
hopefully resolve PR2240
...
llvm-svn: 49999
2008-04-20 19:59:12 +00:00
Chris Lattner
6b05605829
rearrange some code, simplify handling of shifts.
...
llvm-svn: 49995
2008-04-20 18:24:14 +00:00
Chris Lattner
d3018e6a0e
Use simplified ConstantFP::get method, fix a bug handling frem x, 0 with long doubles.
...
llvm-svn: 49976
2008-04-20 00:26:06 +00:00
Chris Lattner
bc26e1bb8a
Implement PR2206.
...
llvm-svn: 49967
2008-04-19 22:17:26 +00:00
Chris Lattner
334d33cad1
refactor handling of symbolic constant folding, picking up
...
a few new cases( see Integer/a1.ll), but not anything that
would happen in practice.
llvm-svn: 49965
2008-04-19 21:58:19 +00:00
Chris Lattner
6072ead8e2
indentation fix.
...
llvm-svn: 49964
2008-04-19 21:13:00 +00:00
Nate Begeman
f2b0b0eb17
Don't eliminate bitcast instructions that change the type of a pointer
...
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Evan Cheng
df1690dc7c
Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
...
llvm-svn: 48792
2008-03-25 20:08:07 +00:00
Dan Gohman
06c45d516d
Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
...
llvm-svn: 47744
2008-02-29 01:42:52 +00:00
Anton Korobeynikov
579f07135a
Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
...
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Chris Lattner
b4c6cc9587
Fix some minor issues folding undef, PR2052
...
llvm-svn: 47314
2008-02-19 06:22:12 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Christopher Lamb
edf0788758
Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
...
llvm-svn: 45082
2007-12-17 01:12:55 +00:00
Chris Lattner
8e6a8f984c
Teach VMCore to constant fold shufflevectors with constant operands.
...
This allows us to compile:
#include <emmintrin.h>
typedef __m128i VSInt16;
typedef short vSInt16 __attribute__ ((__vector_size__ (16)));
VSInt16 t3() {
return (VSInt16)((vSInt16)_mm_set1_epi16(6518));
}
into:
_t3:
movaps LCPI1_0, %xmm0
ret
instead of:
_t3:
movl $6518, %eax
movd %eax, %xmm0
pextrw $0, %xmm0, %eax
xorps %xmm0, %xmm0
pinsrw $0, %eax, %xmm0
punpcklwd %xmm0, %xmm0
pshufd $0, %xmm0, %xmm0
ret
llvm-svn: 44856
2007-12-11 07:49:37 +00:00
Chris Lattner
5c6399eee6
significantly simplify some code, no functionality change.
...
llvm-svn: 44850
2007-12-11 06:07:39 +00:00
Chris Lattner
e8ea0374ac
refactor some code, no functionality change.
...
llvm-svn: 44849
2007-12-11 05:55:02 +00:00
Chris Lattner
d2265b45ae
Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
...
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe. While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".
llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Nate Begeman
d4d45c268c
Add support for vectors to int <-> float casts.
...
llvm-svn: 44204
2007-11-17 03:58:34 +00:00
Dan Gohman
b43e020cdb
Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced
...
by r43510. Gracefully handle constants with vector type that aren't
ConstantVector or ConstantAggregateZero.
llvm-svn: 43579
2007-10-31 21:36:31 +00:00
Dan Gohman
9f39660c20
Add support for folding binary operators with vector zero operands.
...
llvm-svn: 43510
2007-10-30 19:00:49 +00:00
Dale Johannesen
e5facd51cb
Disable attempts to constant fold PPC f128.
...
Remove the assumption that this will happen from
various places.
llvm-svn: 43053
2007-10-16 23:38:29 +00:00
Chris Lattner
2b827fd70d
avoid an APFloat copy.
...
llvm-svn: 42979
2007-10-15 05:34:10 +00:00
Dale Johannesen
19db093b35
Disable some compile-time optimizations on PPC
...
long double.
llvm-svn: 42958
2007-10-14 01:56:47 +00:00
Neil Booth
5f00973393
convertFromInteger, as originally written, expected sign-extended
...
input. APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input. Make this
assumption explicit in the function name.
llvm-svn: 42732
2007-10-07 11:45:55 +00:00
Dale Johannesen
9150652b21
Constant fold int-to-long-double conversions;
...
use APFloat for int-to-float/double; use
round-to-nearest for these (implementation-defined,
seems to match gcc).
llvm-svn: 42484
2007-09-30 18:19:03 +00:00
Dale Johannesen
17663f40b9
Remove no-longer-used variable.
...
llvm-svn: 42329
2007-09-25 23:32:20 +00:00
Dale Johannesen
e7439eff5a
Make APFloat->int conversions deterministic even in
...
cases with undefined behavior.
llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Dale Johannesen
5026f4ba93
float->int conversion rounds toward 0. Duh.
...
Fixes PR1698.
llvm-svn: 42273
2007-09-24 21:06:09 +00:00
Dale Johannesen
acbb26f125
Just use APFloat for const / const. Fixes
...
-1. / -0.
llvm-svn: 42254
2007-09-24 00:32:45 +00:00
Dale Johannesen
cc7c475705
Fix dumb regression in constant folding (Regression/C/casts)
...
llvm-svn: 42165
2007-09-20 16:50:21 +00:00
Dale Johannesen
f4bad97ea0
Fix some long double issues.
...
llvm-svn: 42133
2007-09-19 14:22:58 +00:00
Duncan Sands
a38e527523
Partial fix for PR1678: correct some parts of constant
...
fold that were missed in the fix for PR1646. Probably
this null/not-null logic should be factorized somewhere.
llvm-svn: 42131
2007-09-19 10:16:17 +00:00
Dale Johannesen
028084efe5
Revise previous patch per review comments.
...
Next round of x87 long double stuff.
Getting close now, basically works.
llvm-svn: 41875
2007-09-12 03:30:33 +00:00
Dale Johannesen
245dceb06d
Add APInt interfaces to APFloat (allows directly
...
access to bits). Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling
(untested, probably does not work).
llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Chris Lattner
52fe869374
Fix a buggy constant folding transformation when handling aliases.
...
llvm-svn: 41818
2007-09-10 23:42:42 +00:00
Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
llvm-svn: 41747
2007-09-06 18:13:44 +00:00
David Greene
c656cbb8c2
Update GEP constructors to use an iterator interface to fix
...
GLIBCXX_DEBUG issues.
llvm-svn: 41697
2007-09-04 15:46:09 +00:00