summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/fp16-ops.c
Commit message (Collapse)AuthorAgeFilesLines
* [IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperatorCameron McInally2019-10-141-2/+2
| | | | | | | | Reapply r374240 with fix for Ocaml test, namely Bindings/OCaml/core.ml. Differential Revision: https://reviews.llvm.org/D61675 llvm-svn: 374782
* Revert "[IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator"Dmitri Gribenko2019-10-101-2/+2
| | | | | | | This reverts commit r374240. It broke OCaml tests: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/19014 llvm-svn: 374354
* [IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperatorCameron McInally2019-10-091-2/+2
| | | | | | | | Also update Clang to call Builder.CreateFNeg(...) for UnaryMinus. Differential Revision: https://reviews.llvm.org/D61675 llvm-svn: 374240
* [CodeGen][X86] Fix handling of __fp16 vectors.Akira Hatanaka2017-12-091-35/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* RenderScript support in the FrontendPirama Arumuga Nainar2016-06-091-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Create a new Frontend LangOpt to specify the renderscript language. It is enabled by the "-x renderscript" option from the driver. Add a "kernel" function attribute only for RenderScript (an "ignored attribute" warning is generated otherwise). Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied by the RenderScript LangOpt. Reviewers: rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21198 llvm-svn: 272342
* [Sema] Promote compound assignment exprs. with fp16 LHS and int. RHS.Ahmed Bougacha2015-05-291-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | We catch most of the various other __fp16 implicit conversions to float, but not this one: __fp16 a; int i; ... a += i; For which we used to generate something 'fun' like: %conv = sitofp i32 %i to float %1 = tail call i16 @llvm.convert.to.fp16.f32(float %conv) %add = add i16 %0, %1 Instead, when we have an __fp16 LHS and an integer RHS, we should use float as the result type. While there, add a bunch of missing tests for mixed __fp16/integer expressions. llvm-svn: 238625
* Add flag to enable native half typePirama Arumuga Nainar2015-05-141-36/+139
| | | | | | | | | | | | | | | | | | | Summary: r235215 enables support in LLVM for legalizing f16 type in the IR. AArch64 already had support for this. r235215 and some backend patches brought support for ARM, X86, X86-64, Mips and Mips64. This change exposes the LangOption 'NativeHalfType' in the command line, so the backend legalization can be used if desired. NativeHalfType is enabled for OpenCL (current behavior) or if '-fnative-half-type' is set. Reviewers: olista01, steven_wu, ab Subscribers: cfe-commits, srhines, aemerson Differential Revision: http://reviews.llvm.org/D9781 llvm-svn: 237406
* [CodeGen] Properly support the half FP type with non-native operations.Ahmed Bougacha2015-03-231-134/+148
| | | | | | | | | | | | | | | | | | | | | | 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
* [CodeGen] Convert double -> __fp16 in one step.Ahmed Bougacha2015-03-231-5/+21
| | | | | | | | | | | | | | Fix the CodeGen so that for types bigger than float, instead of converting to fp16 via the sequence "InTy -> float -> fp16", we perform conversions in just one step. This avoids the double rounding which potentially changes results from a natural IEEE-754 operation. rdar://17594379, rdar://17468714 Differential Revision: http://reviews.llvm.org/D4602 Part of: http://reviews.llvm.org/D8367 llvm-svn: 232968
* Add a bunch of missing "CHECK" colons in tests. NFC.Ahmed Bougacha2015-03-141-1/+1
| | | | llvm-svn: 232237
* IR: update Clang to use polymorphic __fp16 conversion intrinsics.Tim Northover2014-07-171-129/+129
| | | | | | There should be no change in semantics at this stage. llvm-svn: 213249
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-1/+1
| | | | | | tests fail. llvm-svn: 188447
* Tests: check for target availability for target-specific tests.Jim Grosbach2012-07-091-0/+1
| | | | | | | | Lots of tests are using an explicit target triple w/o first checking that the target is actually available. Add a REQUIRES clause to a bunch of them. This should hopefully unbreak bots which don't configure w/ all targets enabled. llvm-svn: 159949
* Missed tests for half FP supportAnton Korobeynikov2011-10-141-0/+283
llvm-svn: 142017
OpenPOWER on IntegriCloud