2014-04-15 22:00:29 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
define i32 @test_floattoi32(float %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_floattoi32:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = fptosi float %in to i32
|
|
|
|
%unsigned = fptoui float %in to i32
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
|
|
|
|
; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = sub i32 %signed, %unsigned
|
|
|
|
; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
|
|
|
|
ret i32 %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_doubletoi32(double %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_doubletoi32:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = fptosi double %in to i32
|
|
|
|
%unsigned = fptoui double %in to i32
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
|
|
|
|
; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = sub i32 %signed, %unsigned
|
|
|
|
; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
|
|
|
|
ret i32 %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_floattoi64(float %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_floattoi64:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = fptosi float %in to i64
|
|
|
|
%unsigned = fptoui float %in to i64
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
|
|
|
|
; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = sub i64 %signed, %unsigned
|
|
|
|
; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
|
|
|
|
ret i64 %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_doubletoi64(double %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_doubletoi64:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = fptosi double %in to i64
|
|
|
|
%unsigned = fptoui double %in to i64
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
|
|
|
|
; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = sub i64 %signed, %unsigned
|
|
|
|
; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
|
|
|
|
ret i64 %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @test_i32tofloat(i32 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_i32tofloat:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = sitofp i32 %in to float
|
|
|
|
%unsigned = uitofp i32 %in to float
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
|
|
|
|
; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = fsub float %signed, %unsigned
|
2014-02-16 15:31:05 +08:00
|
|
|
; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
|
2013-01-31 20:12:40 +08:00
|
|
|
ret float %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_i32todouble(i32 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_i32todouble:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = sitofp i32 %in to double
|
|
|
|
%unsigned = uitofp i32 %in to double
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
|
|
|
|
; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = fsub double %signed, %unsigned
|
|
|
|
; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
ret double %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @test_i64tofloat(i64 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_i64tofloat:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = sitofp i64 %in to float
|
|
|
|
%unsigned = uitofp i64 %in to float
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
|
|
|
|
; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = fsub float %signed, %unsigned
|
|
|
|
; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
ret float %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_i64todouble(i64 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_i64todouble:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%signed = sitofp i64 %in to double
|
|
|
|
%unsigned = uitofp i64 %in to double
|
2013-10-09 15:53:57 +08:00
|
|
|
; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
|
|
|
|
; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = fsub double %signed, %unsigned
|
|
|
|
; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
|
|
|
|
ret double %res
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_bitcastfloattoi32(float %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_bitcastfloattoi32:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = bitcast float %in to i32
|
|
|
|
; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_bitcastdoubletoi64(double %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_bitcastdoubletoi64:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = bitcast double %in to i64
|
|
|
|
; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @test_bitcasti32tofloat(i32 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_bitcasti32tofloat:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = bitcast i32 %in to float
|
|
|
|
; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
|
|
|
|
ret float %res
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_bitcasti64todouble(i64 %in) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_bitcasti64todouble:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%res = bitcast i64 %in to double
|
|
|
|
; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
|
|
|
|
ret double %res
|
|
|
|
|
|
|
|
}
|
2016-04-22 05:02:25 +08:00
|
|
|
|
|
|
|
define double @bitcast_fabs(double %x) {
|
|
|
|
; CHECK-LABEL: bitcast_fabs:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ; %bb.0:
|
2016-06-03 04:01:37 +08:00
|
|
|
; CHECK-NEXT: fabs d0, d0
|
2016-04-22 05:02:25 +08:00
|
|
|
; CHECK-NEXT: ret
|
|
|
|
;
|
|
|
|
%bc1 = bitcast double %x to i64
|
|
|
|
%and = and i64 %bc1, 9223372036854775807
|
|
|
|
%bc2 = bitcast i64 %and to double
|
|
|
|
ret double %bc2
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @bitcast_fneg(float %x) {
|
|
|
|
; CHECK-LABEL: bitcast_fneg:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ; %bb.0:
|
2016-06-03 04:01:37 +08:00
|
|
|
; CHECK-NEXT: fneg s0, s0
|
2016-04-22 05:02:25 +08:00
|
|
|
; CHECK-NEXT: ret
|
|
|
|
;
|
|
|
|
%bc1 = bitcast float %x to i32
|
|
|
|
%xor = xor i32 %bc1, 2147483648
|
|
|
|
%bc2 = bitcast i32 %xor to float
|
|
|
|
ret float %bc2
|
|
|
|
}
|
|
|
|
|