2012-07-10 02:34:21 +08:00
|
|
|
// REQUIRES: arm-registered-target
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s --check-prefix=NOTNATIVE --check-prefix=CHECK
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi %s | FileCheck %s --check-prefix=NOTNATIVE --check-prefix=CHECK
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-linux-gnu %s | FileCheck %s --check-prefix=NOTNATIVE --check-prefix=CHECK
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -fallow-half-arguments-and-returns %s | FileCheck %s --check-prefix=NOTNATIVE --check-prefix=CHECK
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fallow-half-arguments-and-returns %s | FileCheck %s --check-prefix=NOTNATIVE --check-prefix=CHECK
|
2015-05-15 07:44:18 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -fnative-half-type %s \
|
|
|
|
// RUN: | FileCheck %s --check-prefix=NATIVE-HALF
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
|
|
|
|
// RUN: | FileCheck %s --check-prefix=NATIVE-HALF
|
2016-06-10 07:34:20 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
|
|
|
|
// RUN: | FileCheck %s --check-prefix=NATIVE-HALF
|
2011-10-15 07:32:50 +08:00
|
|
|
typedef unsigned cond_t;
|
|
|
|
|
|
|
|
volatile cond_t test;
|
2015-05-30 06:54:57 +08:00
|
|
|
volatile int i0;
|
2011-10-15 07:32:50 +08:00
|
|
|
volatile __fp16 h0 = 0.0, h1 = 1.0, h2;
|
|
|
|
volatile float f0, f1, f2;
|
2015-03-24 01:48:07 +08:00
|
|
|
volatile double d0;
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
short s0;
|
2011-10-15 07:32:50 +08:00
|
|
|
|
|
|
|
void foo(void) {
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @foo()
|
2011-10-15 07:32:50 +08:00
|
|
|
|
|
|
|
// Check unary ops
|
|
|
|
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: [[F16TOF32:fpext half]]
|
2015-03-14 09:10:19 +08:00
|
|
|
// CHECK: fptoui float
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fptoui half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: uitofp i32
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: [[F32TOF16:fptrunc float]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: uitofp i32 {{.*}} to half
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
h0 = (test);
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fcmp une float
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fcmp une half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (!h1);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fsub half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = -h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: load volatile half
|
|
|
|
// NATIVE-HALF-NEXT: store volatile half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = +h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1++;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
++h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
--h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1--;
|
|
|
|
|
|
|
|
// Check binary ops with various operands
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fmul half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = h0 * h2;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fmul half
|
2015-03-24 01:48:07 +08:00
|
|
|
h1 = h0 * (__fp16) -2.0f;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fmul float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = h0 * f2;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fmul float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = f0 * h2;
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fmul float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: fmul half
|
|
|
|
h1 = h0 * i0;
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fdiv half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h0 / h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fdiv half
|
2015-03-24 01:48:07 +08:00
|
|
|
h1 = (h0 / (__fp16) -2.0f);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fdiv float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h0 / f2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fdiv float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (f0 / h2);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fdiv float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: fdiv half
|
|
|
|
h1 = (h0 / i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h2 + h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = ((__fp16)-2.0 + h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fadd float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h2 + f0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fadd float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (f2 + h0);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fadd float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: fadd half
|
|
|
|
h1 = (h0 + i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fsub half
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h2 - h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fsub half
|
2015-03-24 01:48:07 +08:00
|
|
|
h1 = ((__fp16)-2.0f - h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fsub float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h2 - f0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fsub float
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (f2 - h0);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fsub float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: fsub half
|
|
|
|
h1 = (h0 - i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fcmp olt half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 < h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fcmp olt half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 < (__fp16)42.0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp olt float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 < f0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp olt float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f2 < h0);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fcmp olt half
|
|
|
|
test = (i0 < h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp olt float
|
|
|
|
// NATIVE-HALF: fcmp olt half
|
|
|
|
test = (h0 < i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fcmp ogt half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0 > h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fcmp ogt half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = ((__fp16)42.0 > h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp ogt float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0 > f2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp ogt float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f0 > h2);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fcmp ogt half
|
|
|
|
test = (i0 > h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp ogt float
|
|
|
|
// NATIVE-HALF: fcmp ogt half
|
|
|
|
test = (h0 > i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fcmp ole half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 <= h0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fcmp ole half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 <= (__fp16)42.0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp ole float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h2 <= f0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp ole float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f2 <= h0);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fcmp ole half
|
|
|
|
test = (i0 <= h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp ole float
|
|
|
|
// NATIVE-HALF: fcmp ole half
|
|
|
|
test = (h0 <= i0);
|
|
|
|
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fcmp oge half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0 >= h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fcmp oge half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0 >= (__fp16)-2.0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp oge float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h0 >= f2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp oge float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f0 >= h2);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fcmp oge half
|
|
|
|
test = (i0 >= h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp oge float
|
|
|
|
// NATIVE-HALF: fcmp oge half
|
|
|
|
test = (h0 >= i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fcmp oeq half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 == h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fcmp oeq half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 == (__fp16)1.0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp oeq float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 == f1);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp oeq float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f1 == h1);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fcmp oeq half
|
|
|
|
test = (i0 == h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp oeq float
|
|
|
|
// NATIVE-HALF: fcmp oeq half
|
|
|
|
test = (h0 == i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fcmp une half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 != h2);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fcmp une half
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 != (__fp16)1.0);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp une float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (h1 != f1);
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fcmp une float
|
2011-10-15 07:32:50 +08:00
|
|
|
test = (f1 != h1);
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fcmp une half
|
|
|
|
test = (i0 != h0);
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fcmp une float
|
|
|
|
// NATIVE-HALF: fcmp une half
|
|
|
|
test = (h0 != i0);
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fcmp une float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fcmp une half {{.*}}, 0xH0000
|
2011-10-15 07:32:50 +08:00
|
|
|
h1 = (h1 ? h2 : h0);
|
|
|
|
// Check assignments (inc. compound)
|
|
|
|
h0 = h1;
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: store {{.*}} half 0xHC000
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: store {{.*}} half 0xHC000
|
2015-03-24 01:48:07 +08:00
|
|
|
h0 = (__fp16)-2.0f;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fptrunc float
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 = f0;
|
|
|
|
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
h0 = i0;
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fptosi float {{.*}} to i32
|
|
|
|
// NATIVE-HALF: fptosi half {{.*}} to i32
|
|
|
|
i0 = h0;
|
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2011-10-15 07:32:50 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 += h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fadd half
|
2015-03-24 01:48:07 +08:00
|
|
|
h0 += (__fp16)1.0f;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fadd float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fadd float
|
|
|
|
// NATIVE-HALF: fptrunc float
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 += f2;
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: fadd float
|
|
|
|
// CHECK: fptosi float {{.*}} to i32
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fadd half
|
|
|
|
// NATIVE-HALF: fptosi half {{.*}} to i32
|
|
|
|
i0 += h0;
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fadd float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fadd half
|
|
|
|
h0 += i0;
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fsub half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 -= h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fsub half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 -= (__fp16)1.0;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fsub float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fsub float
|
|
|
|
// NATIVE-HALF: fptrunc float
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 -= f2;
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: fsub float
|
|
|
|
// CHECK: fptosi float {{.*}} to i32
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fsub half
|
|
|
|
// NATIVE-HALF: fptosi half {{.*}} to i32
|
|
|
|
i0 -= h0;
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fsub float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fsub half
|
|
|
|
h0 -= i0;
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fmul half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 *= h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fmul half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 *= (__fp16)1.0;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fmul float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fmul float
|
|
|
|
// NATIVE-HALF: fptrunc float
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 *= f2;
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: fmul float
|
|
|
|
// CHECK: fptosi float {{.*}} to i32
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fmul half
|
|
|
|
// NATIVE-HALF: fptosi half {{.*}} to i32
|
|
|
|
i0 *= h0;
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fmul float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fmul half
|
|
|
|
h0 *= i0;
|
2011-10-15 07:32:50 +08:00
|
|
|
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fdiv half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 /= h1;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fdiv half
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 /= (__fp16)1.0;
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// CHECK: fdiv float
|
[CodeGen] Properly support the half FP type with non-native operations.
On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.
The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.
This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.
Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367
llvm-svn: 232971
2015-03-24 01:54:16 +08:00
|
|
|
// CHECK: [[F32TOF16]]
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half
|
|
|
|
// NATIVE-HALF: fdiv float
|
|
|
|
// NATIVE-HALF: fptrunc float
|
2011-10-15 07:32:50 +08:00
|
|
|
h0 /= f2;
|
2015-05-30 06:54:57 +08:00
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: fdiv float
|
|
|
|
// CHECK: fptosi float {{.*}} to i32
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fdiv half
|
|
|
|
// NATIVE-HALF: fptosi half {{.*}} to i32
|
|
|
|
i0 /= h0;
|
|
|
|
// CHECK: sitofp i32 {{.*}} to float
|
|
|
|
// CHECK: [[F16TOF32]]
|
|
|
|
// CHECK: fdiv float
|
|
|
|
// CHECK: [[F32TOF16]]
|
|
|
|
// NATIVE-HALF: sitofp i32 {{.*}} to half
|
|
|
|
// NATIVE-HALF: fdiv half
|
|
|
|
h0 /= i0;
|
2015-03-24 01:48:07 +08:00
|
|
|
|
|
|
|
// Check conversions to/from double
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: fptrunc double {{.*}} to half
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fptrunc double {{.*}} to half
|
2015-03-24 01:48:07 +08:00
|
|
|
h0 = d0;
|
|
|
|
|
|
|
|
// CHECK: [[MID:%.*]] = fptrunc double {{%.*}} to float
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: fptrunc float [[MID]] to half
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: [[MID:%.*]] = fptrunc double {{%.*}} to float
|
|
|
|
// NATIVE-HALF: fptrunc float {{.*}} to half
|
2015-03-24 01:48:07 +08:00
|
|
|
h0 = (float)d0;
|
|
|
|
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: fpext half {{.*}} to double
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: fpext half {{.*}} to double
|
2015-03-24 01:48:07 +08:00
|
|
|
d0 = h0;
|
|
|
|
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
// NOTNATIVE: [[MID:%.*]] = fpext half {{.*}} to float
|
2015-03-24 01:48:07 +08:00
|
|
|
// CHECK: fpext float [[MID]] to double
|
2015-05-15 07:44:18 +08:00
|
|
|
// NATIVE-HALF: [[MID:%.*]] = fpext half {{.*}} to float
|
|
|
|
// NATIVE-HALF: fpext float [[MID]] to double
|
2015-03-24 01:48:07 +08:00
|
|
|
d0 = (float)h0;
|
[CodeGen][X86] Fix handling of __fp16 vectors.
This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:
half4 hv0, hv1, hv2; // these are vectors of __fp16.
void foo221() {
hv0 = hv1 + hv2;
}
clang generates the following IR, in which two i16 vectors are added:
@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8
define void @foo221() {
%0 = load <4 x i16>, <4 x i16>* @hv1, align 8
%1 = load <4 x i16>, <4 x i16>* @hv2, align 8
%add = add <4 x i16> %0, %1
store <4 x i16> %add, <4 x i16>* @hv0, align 8
ret void
}
To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:
__fp16 a;
short b;
void foo1() {
a = b;
}
@b = common global i16 0, align 2
@a = common global i16 0, align 2
define void @foo1() #0 {
%0 = load i16, i16* @b, align 2
store i16 %0, i16* @a, align 2
ret void
}
rdar://problem/20625184
Differential Revision: https://reviews.llvm.org/D40112
llvm-svn: 320215
2017-12-09 08:02:37 +08:00
|
|
|
|
|
|
|
// NOTNATIVE: [[V1:%.*]] = load i16, i16* @s0
|
|
|
|
// NOTNATIVE: [[CONV:%.*]] = sitofp i16 [[V1]] to float
|
|
|
|
// NOTNATIVE: [[TRUNC:%.*]] = fptrunc float [[CONV]] to half
|
|
|
|
// NOTNATIVE: store volatile half [[TRUNC]], half* @h0
|
|
|
|
h0 = s0;
|
2011-10-15 07:32:50 +08:00
|
|
|
}
|