1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/test/CodeGen/AArch64/fcvt-int.ll
Tim Northover e2b0519ed8 Add AArch64 as an experimental target.
This patch adds support for AArch64 (ARM's 64-bit architecture) to
LLVM in the "experimental" category. Currently, it won't be built
unless requested explicitly.

This initial commit should have support for:
    + Assembly of all scalar (i.e. non-NEON, non-Crypto) instructions
      (except the late addition CRC instructions).
    + CodeGen features required for C++03 and C99.
    + Compilation for the "small" memory model: code+static data <
      4GB.
    + Absolute and position-independent code.
    + GNU-style (i.e. "__thread") TLS.
    + Debugging information.

The principal omission, currently, is performance tuning.

This patch excludes the NEON support also reviewed due to an outbreak of
batshit insanity in our legal department. That will be committed soon bringing
the changes to precisely what has been approved.

Further reviews would be gratefully received.

llvm-svn: 174054
2013-01-31 12:12:40 +00:00

152 lines
3.5 KiB
LLVM

; RUN: llc -verify-machineinstrs < %s -march=aarch64 | FileCheck %s
define i32 @test_floattoi32(float %in) {
; CHECK: test_floattoi32:
%signed = fptosi float %in to i32
%unsigned = fptoui float %in to i32
; CHECK: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
; CHECK: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
%res = sub i32 %signed, %unsigned
; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
ret i32 %res
; CHECK: ret
}
define i32 @test_doubletoi32(double %in) {
; CHECK: test_doubletoi32:
%signed = fptosi double %in to i32
%unsigned = fptoui double %in to i32
; CHECK: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
; CHECK: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
%res = sub i32 %signed, %unsigned
; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
ret i32 %res
; CHECK: ret
}
define i64 @test_floattoi64(float %in) {
; CHECK: test_floattoi64:
%signed = fptosi float %in to i64
%unsigned = fptoui float %in to i64
; CHECK: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
; CHECK: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
%res = sub i64 %signed, %unsigned
; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
ret i64 %res
; CHECK: ret
}
define i64 @test_doubletoi64(double %in) {
; CHECK: test_doubletoi64:
%signed = fptosi double %in to i64
%unsigned = fptoui double %in to i64
; CHECK: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
; CHECK: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
%res = sub i64 %signed, %unsigned
; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
ret i64 %res
; CHECK: ret
}
define float @test_i32tofloat(i32 %in) {
; CHECK: test_i32tofloat:
%signed = sitofp i32 %in to float
%unsigned = uitofp i32 %in to float
; CHECK: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
; CHECK: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
%res = fsub float %signed, %unsigned
; CHECL: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
ret float %res
; CHECK: ret
}
define double @test_i32todouble(i32 %in) {
; CHECK: test_i32todouble:
%signed = sitofp i32 %in to double
%unsigned = uitofp i32 %in to double
; CHECK: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
; CHECK: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
%res = fsub double %signed, %unsigned
; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
ret double %res
; CHECK: ret
}
define float @test_i64tofloat(i64 %in) {
; CHECK: test_i64tofloat:
%signed = sitofp i64 %in to float
%unsigned = uitofp i64 %in to float
; CHECK: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
; CHECK: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
%res = fsub float %signed, %unsigned
; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
ret float %res
; CHECK: ret
}
define double @test_i64todouble(i64 %in) {
; CHECK: test_i64todouble:
%signed = sitofp i64 %in to double
%unsigned = uitofp i64 %in to double
; CHECK: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
; CHECK: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
%res = fsub double %signed, %unsigned
; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
ret double %res
; CHECK: ret
}
define i32 @test_bitcastfloattoi32(float %in) {
; CHECK: test_bitcastfloattoi32:
%res = bitcast float %in to i32
; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
ret i32 %res
}
define i64 @test_bitcastdoubletoi64(double %in) {
; CHECK: test_bitcastdoubletoi64:
%res = bitcast double %in to i64
; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
ret i64 %res
}
define float @test_bitcasti32tofloat(i32 %in) {
; CHECK: test_bitcasti32tofloat:
%res = bitcast i32 %in to float
; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
ret float %res
}
define double @test_bitcasti64todouble(i64 %in) {
; CHECK: test_bitcasti64todouble:
%res = bitcast i64 %in to double
; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
ret double %res
}