llvm/test/ExecutionEngine/MCJIT/test-cast.ll
Peter Collingbourne fbb662f840 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

Differential Revision: http://llvm-reviews.chandlerc.com/D254

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 17:27:22 +00:00

110 lines
4.4 KiB
LLVM

; RUN: %lli_mcjit %s > /dev/null
define i32 @foo() {
ret i32 0
}
define i32 @main() {
icmp ne i1 true, false ; <i1>:1 [#uses=0]
zext i1 true to i8 ; <i8>:2 [#uses=0]
zext i1 true to i8 ; <i8>:3 [#uses=0]
zext i1 true to i16 ; <i16>:4 [#uses=0]
zext i1 true to i16 ; <i16>:5 [#uses=0]
zext i1 true to i32 ; <i32>:6 [#uses=0]
zext i1 true to i32 ; <i32>:7 [#uses=0]
zext i1 true to i64 ; <i64>:8 [#uses=0]
zext i1 true to i64 ; <i64>:9 [#uses=0]
uitofp i1 true to float ; <float>:10 [#uses=0]
uitofp i1 true to double ; <double>:11 [#uses=0]
icmp ne i8 0, 0 ; <i1>:12 [#uses=0]
icmp ne i8 1, 0 ; <i1>:13 [#uses=0]
bitcast i8 0 to i8 ; <i8>:14 [#uses=0]
bitcast i8 -1 to i8 ; <i8>:15 [#uses=0]
sext i8 4 to i16 ; <i16>:16 [#uses=0]
sext i8 4 to i16 ; <i16>:17 [#uses=0]
sext i8 4 to i64 ; <i64>:18 [#uses=0]
sext i8 4 to i64 ; <i64>:19 [#uses=0]
sitofp i8 4 to float ; <float>:20 [#uses=0]
sitofp i8 4 to double ; <double>:21 [#uses=0]
icmp ne i8 0, 0 ; <i1>:22 [#uses=0]
icmp ne i8 1, 0 ; <i1>:23 [#uses=0]
bitcast i8 0 to i8 ; <i8>:24 [#uses=0]
bitcast i8 1 to i8 ; <i8>:25 [#uses=0]
zext i8 4 to i16 ; <i16>:26 [#uses=0]
zext i8 4 to i16 ; <i16>:27 [#uses=0]
zext i8 4 to i64 ; <i64>:28 [#uses=0]
zext i8 4 to i64 ; <i64>:29 [#uses=0]
uitofp i8 0 to float ; <float>:30 [#uses=0]
uitofp i8 0 to double ; <double>:31 [#uses=0]
icmp ne i16 1, 0 ; <i1>:32 [#uses=0]
trunc i16 -1 to i8 ; <i8>:33 [#uses=0]
trunc i16 255 to i8 ; <i8>:34 [#uses=0]
bitcast i16 0 to i16 ; <i16>:35 [#uses=0]
bitcast i16 0 to i16 ; <i16>:36 [#uses=0]
sext i16 0 to i64 ; <i64>:37 [#uses=0]
sext i16 0 to i64 ; <i64>:38 [#uses=0]
sitofp i16 0 to float ; <float>:39 [#uses=0]
sitofp i16 0 to double ; <double>:40 [#uses=0]
icmp ne i16 1, 0 ; <i1>:41 [#uses=0]
trunc i16 1 to i8 ; <i8>:42 [#uses=0]
trunc i16 255 to i8 ; <i8>:43 [#uses=0]
bitcast i16 0 to i16 ; <i16>:44 [#uses=0]
bitcast i16 0 to i16 ; <i16>:45 [#uses=0]
zext i16 0 to i64 ; <i64>:46 [#uses=0]
zext i16 0 to i64 ; <i64>:47 [#uses=0]
uitofp i16 0 to float ; <float>:48 [#uses=0]
uitofp i16 0 to double ; <double>:49 [#uses=0]
icmp ne i32 6, 0 ; <i1>:50 [#uses=0]
trunc i32 -6 to i8 ; <i8>:51 [#uses=0]
trunc i32 6 to i8 ; <i8>:52 [#uses=0]
trunc i32 6 to i16 ; <i16>:53 [#uses=0]
bitcast i32 0 to i32 ; <i32>:54 [#uses=0]
sext i32 0 to i64 ; <i64>:55 [#uses=0]
sext i32 0 to i64 ; <i64>:56 [#uses=0]
sitofp i32 0 to float ; <float>:57 [#uses=0]
sitofp i32 0 to double ; <double>:58 [#uses=0]
icmp ne i32 6, 0 ; <i1>:59 [#uses=0]
trunc i32 7 to i8 ; <i8>:60 [#uses=0]
trunc i32 8 to i8 ; <i8>:61 [#uses=0]
trunc i32 9 to i16 ; <i16>:62 [#uses=0]
bitcast i32 10 to i32 ; <i32>:63 [#uses=0]
zext i32 0 to i64 ; <i64>:64 [#uses=0]
zext i32 0 to i64 ; <i64>:65 [#uses=0]
uitofp i32 0 to float ; <float>:66 [#uses=0]
uitofp i32 0 to double ; <double>:67 [#uses=0]
icmp ne i64 0, 0 ; <i1>:68 [#uses=0]
trunc i64 0 to i8 ; <i8>:69 [#uses=0]
trunc i64 0 to i8 ; <i8>:70 [#uses=0]
trunc i64 0 to i16 ; <i16>:71 [#uses=0]
trunc i64 0 to i16 ; <i16>:72 [#uses=0]
trunc i64 0 to i32 ; <i32>:73 [#uses=0]
trunc i64 0 to i32 ; <i32>:74 [#uses=0]
bitcast i64 0 to i64 ; <i64>:75 [#uses=0]
bitcast i64 0 to i64 ; <i64>:76 [#uses=0]
sitofp i64 0 to float ; <float>:77 [#uses=0]
sitofp i64 0 to double ; <double>:78 [#uses=0]
icmp ne i64 1, 0 ; <i1>:79 [#uses=0]
trunc i64 1 to i8 ; <i8>:80 [#uses=0]
trunc i64 1 to i8 ; <i8>:81 [#uses=0]
trunc i64 1 to i16 ; <i16>:82 [#uses=0]
trunc i64 1 to i16 ; <i16>:83 [#uses=0]
trunc i64 1 to i32 ; <i32>:84 [#uses=0]
trunc i64 1 to i32 ; <i32>:85 [#uses=0]
bitcast i64 1 to i64 ; <i64>:86 [#uses=0]
bitcast i64 1 to i64 ; <i64>:87 [#uses=0]
uitofp i64 1 to float ; <float>:88 [#uses=0]
uitofp i64 0 to double ; <double>:89 [#uses=0]
bitcast float 0.000000e+00 to float ; <float>:90 [#uses=0]
fpext float 0.000000e+00 to double ; <double>:91 [#uses=0]
fptosi double 0.000000e+00 to i8 ; <i8>:92 [#uses=0]
fptoui double 0.000000e+00 to i8 ; <i8>:93 [#uses=0]
fptosi double 0.000000e+00 to i16 ; <i16>:94 [#uses=0]
fptoui double 0.000000e+00 to i16 ; <i16>:95 [#uses=0]
fptosi double 0.000000e+00 to i32 ; <i32>:96 [#uses=0]
fptoui double 0.000000e+00 to i32 ; <i32>:97 [#uses=0]
fptosi double 0.000000e+00 to i64 ; <i64>:98 [#uses=0]
fptrunc double 0.000000e+00 to float ; <float>:99 [#uses=0]
bitcast double 0.000000e+00 to double ; <double>:100 [#uses=0]
ret i32 0
}