[clang] f926826 - [SystemZ] Add "REQUIRES: systemz-registered-target" on test.

2022-12-06 Thread Jonas Paulsson via cfe-commits
Author: Jonas Paulsson Date: 2022-12-06T13:38:48-06:00 New Revision: f926826c2e836b09cd2517775758f373bbc330bf URL: https://github.com/llvm/llvm-project/commit/f926826c2e836b09cd2517775758f373bbc330bf DIFF: https://github.com/llvm/llvm-project/commit/f926826c2e836b09cd2517775758f373bbc330bf.diff

Re: [PATCH] D17142: SystemZ: Check required features when handling builtins

2016-03-29 Thread Jonas Paulsson via cfe-commits
jonpa retitled this revision from "SystemZ: Check that argument -fzvector is only given for -z13" to "SystemZ: Check required features when handling builtins". jonpa updated the summary for this revision. jonpa updated this revision to Diff 51910. jonpa added a comment. This patch has been rewor

Re: [PATCH] D17142: SystemZ: Check required features when handling builtins

2016-03-30 Thread Jonas Paulsson via cfe-commits
jonpa updated this revision to Diff 52026. jonpa added a comment. Tests updated to run with -verify and now work as expected. http://reviews.llvm.org/D17142 Files: include/clang/Basic/BuiltinsSystemZ.def lib/Basic/Targets.cpp test/CodeGen/builtins-systemz-generic0.c test/CodeGen/builtin

r264873 - [SystemZ] Specify required features for builtins.

2016-03-30 Thread Jonas Paulsson via cfe-commits
Author: jonpa Date: Wed Mar 30 10:51:24 2016 New Revision: 264873 URL: http://llvm.org/viewvc/llvm-project?rev=264873&view=rev Log: [SystemZ] Specify required features for builtins. BuiltinsSystemZ.def is extended to include the required processor features per intrinsic. New test test/CodeGen/bu

Re: [PATCH] D17142: SystemZ: Check required features when handling builtins

2016-03-30 Thread Jonas Paulsson via cfe-commits
jonpa added a comment. Tests updated per instructions, and commited as r264873. http://reviews.llvm.org/D17142 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-15 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Any further comments on this, anyone? I guess I would like to commit the common-code parts, i.e. the introduction of the NoExt attribute, and keep the check in the SystemZ (disabled by default). Later on, maybe the check could be moved to the verifier. Does this seem reasonab

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-15 Thread Jonas Paulsson via cfe-commits
@@ -1185,6 +1189,9 @@ Currently, only the following parameter attributes are defined: value should be sign-extended to the extent required by the target's ABI (which is usually 32-bits) by the caller (for a parameter) or the callee (for a return value). +``noext``

[clang] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-06 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 created https://github.com/llvm/llvm-project/pull/94729 This broke an Ubuntu build. This partially reverts 20d497c (SystemZ part only). >From 9340b545ec2381937919dfd925940a191244234b Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Fri, 7 Jun 2024 08:24:16 +02

[clang] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-06 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: clang --version Target: s390x-ibm-linux https://github.com/llvm/llvm-project/pull/94729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-06 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: gcc -dumpmachine s390x-linux-gnu https://github.com/llvm/llvm-project/pull/94729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: I think other folks than myself also got a similar problem, so it's not just on my machine / setup. Should everybody set LLVM_DEFAULT_TARGET_TRIPLE with cmake instead of this patch? Sorry, not very familiar with this... Would it be ok to apply this for now? https://github.c

[clang] [llvm] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-07 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/94729 >From 9340b545ec2381937919dfd925940a191244234b Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Fri, 7 Jun 2024 08:24:16 +0200 Subject: [PATCH 1/3] Revert changes in AddDefaultGCCPrefixes() for SystemZTripl

[clang] [llvm] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: That seems to fix at least my Ubuntu build. https://github.com/llvm/llvm-project/pull/94729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: (patch updated) https://github.com/llvm/llvm-project/pull/94729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Revert changes in AddDefaultGCCPrefixes() for SystemZTriples. (PR #94729)

2024-06-08 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 closed https://github.com/llvm/llvm-project/pull/94729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-27 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/100757 >From 834d8bcd0077f0691ab33983cc72697ff6e65793 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Mon, 11 Oct 2021 19:08:42 +0200 Subject: [PATCH] VerifyIntegerArgs() i8 test. LangRef text. tests IP Tests pa

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-27 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch rebased. Tests failing as before: ``` Failed Tests (44): Clang :: CodeGenObjC 1 fail Clang :: Interpreter 15 fails Clang-Unit :: Interpreter18 fails LLVM-Unit :: ExecutionEngine/Orc/./

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-27 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > The JIT tests should be fixed so that they reflect what a front-end developer > should actually emit as LLVM IR. Do you mean this specifically for clang-repl, or all of them? Please give some more details (following from previous discussions here and on discourse - see link

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-05 Thread Jonas Paulsson via cfe-commits
@@ -1185,6 +1189,9 @@ Currently, only the following parameter attributes are defined: value should be sign-extended to the extent required by the target's ABI (which is usually 32-bits) by the caller (for a parameter) or the callee (for a return value). +``noext``

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-05 Thread Jonas Paulsson via cfe-commits
@@ -2,7 +2,7 @@ ; PR933 JonPsson1 wrote: Handling of these tests here: https://github.com/llvm/llvm-project/pull/101944. https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-05 Thread Jonas Paulsson via cfe-commits
@@ -2,7 +2,7 @@ ; PR933 JonPsson1 wrote: (committed now) https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-05 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > Could you please post an RFC on discourse for this (or link it if it already > exists)? Made an attempt here: https://discourse.llvm.org/t/target-abi-improve-call-parameters-extensions-handling/80553. https://github.com/llvm/llvm-project/pull/100757

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-08-22 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch updated per @nikic suggestion to use a TargetOption flag to simply disable this for llc. With all the llc lit tests out of the way, I now see: - 1 test failing in CodeGenObjC - failing tests in clang/test/Interpreter - failing tetss in llvm/test/ExecutionEngine/Orc/./OrcJ

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-13 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/100757 >From 99116cbe7fa4ce73b7dd242052cdfd59331f5338 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Mon, 11 Oct 2021 19:08:42 +0200 Subject: [PATCH 1/2] VerifyIntegerArgs() i8 test. LangRef text. tests IP Tests

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-13 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > I think the general direction is fine here. I would suggest to split this up > into three parts: 1. Add noext attribute and disabled verification, 2. fix > any verification failures (e.g. by emitting noext), 3. enable verification. > > It would be good to still be able to ena

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-09 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 created https://github.com/llvm/llvm-project/pull/111740 Add extension attributes in declarations of _Block_object_dispose and _Block_object_assign. In order to make this one-liners wherever needed, a new casting method FunctionCallee::getAsFunction() has been add

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-11 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch updated to pass an extension attribute for each retval/parameter, per your suggestion. There may possibly be cases of NoExt (struct-in-reg) that also need to be handled, but I will wait with that until I have a test case. Does this seem ok (for now at least), or would y

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-07 Thread Jonas Paulsson via cfe-commits
@@ -784,6 +791,20 @@ bool SystemZTargetLowering::useSoftFloat() const { return Subtarget.hasSoftFloat(); } +MVT SystemZTargetLowering::getRegisterTypeForCallingConv( + LLVMContext &Context, CallingConv::ID CC, + EVT VT) const { + // 128-bit single-element vector t

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-16 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: gentle ping... @efriedma-quic @nikic https://github.com/llvm/llvm-project/pull/111740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-21 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Ping! I'd love to get this check enabled by default after fixing the issues I see... This is the only one for Objective-C (the second one here came up after fixing the first one). https://github.com/llvm/llvm-project/pull/111740 __

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-11 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/111740 >From fb8b76aca00b97166e56fcaefc241850b2535f94 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Wed, 9 Oct 2024 18:51:22 +0200 Subject: [PATCH 1/3] Add SExt attr to 2nd arg --- clang/lib/CodeGen/CGBlocks.

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-11-04 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: What does it mean that this is a "draft"? It seems to me that this is ready for a regular review..? https://github.com/llvm/llvm-project/pull/113506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-30 Thread Jonas Paulsson via cfe-commits
@@ -1597,6 +1618,15 @@ bool SystemZTargetLowering::splitValueIntoRegisterParts( return true; } + // Convert f16 to f32 (Out-arg). + if (PartVT == MVT::f16) { +assert(NumParts == 1 && ""); +SDValue I16Val = DAG.getBitcast(MVT::i16, Val); +SDValue I32Val = DA

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-30 Thread Jonas Paulsson via cfe-commits
@@ -16534,7 +16534,7 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, PromoteType = QualType(); } } -if (TInfo->getType()->isSpecificBuiltinType(BuiltinType::Float)) +if (TInfo->getType()->isFloat16Type() || TInfo->getType()->isFloat32T

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-10-28 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > SetLLVMFunctionAttributes() should add the appropriate signext/zeroext > attribute. At least, it appears to work in my testing. I'll add a regression > test. Ah, I see. I ran this now on SystemZ and can confirm that this is now getting the proper extension attributes. A tes

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-10-25 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: It would be great if this new method also called TargetLibraryInfo and set the extension attributes for any integer <=32 bits... Or are you maybe waiting with that as a separate patch? https://github.com/llvm/llvm-project/pull/113506 ___

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-10-25 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > I looked to see how hard it would be to lower the clang type... seems like > it's not hard. Pushed #113506. Let me know what you think. > > If there's some complication I'm not seeing, I think your suggested API in > the current version of this patch makes sense... but using

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-09-18 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 created https://github.com/llvm/llvm-project/pull/109164 Make sure that fp16<=>float conversions are expanded to libcalls and that 16-bit fp values can be loaded and stored properly via GPRs. With this patch the Half IR Type used in operations should be handled cor

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
@@ -9800,3 +9817,45 @@ SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op, ISD::EXTRACT_VECTOR_ELT, DL, VT, DAG.getBitcast(OpVT, Op), DAG.getConstant(OpVT.getVectorNumElements() - 1, DL, MVT::i32)); } + +// Only consider a function fully internal as long

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
@@ -9800,3 +9817,45 @@ SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op, ISD::EXTRACT_VECTOR_ELT, DL, VT, DAG.getBitcast(OpVT, Op), DAG.getConstant(OpVT.getVectorNumElements() - 1, DL, MVT::i32)); } + +// Only consider a function fully internal as long

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-18 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: gentle ping to @nikic https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-09-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/109164 >From c70d421c42417a3f1a266907ef36057e51183d97 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Tue, 17 Sep 2024 19:34:34 +0200 Subject: [PATCH] Initial experiments --- clang/lib/Basic/Targets/SystemZ.h

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-09-19 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > Note that you need to also have softPromoteHalfType return true to get > correct legalization for half operations. Thanks for pointing that out - patch updated. https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits maili

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 closed https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: @uweigand SystemZ parts ok? https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 updated https://github.com/llvm/llvm-project/pull/100757 >From 1e7544f684579ed2016f4037a611a5939adabee9 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Mon, 11 Oct 2021 19:08:42 +0200 Subject: [PATCH 1/3] VerifyIntegerArgs() i8 test. LangRef text. tests IP Tests

[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)

2024-09-19 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: @nikic thanks for review - patch updated. https://github.com/llvm/llvm-project/pull/100757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-10-02 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch updated after some progress... With this version, the fp16 values are passed to conversion functions as integer, which seems to be the default. It is however a bit tricky to do this and at the same time pass half values in FP registers. At this point I wonder for one th

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-06 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch improved further: - Atomic memops handled. - Spill/reload Handled in loadRegFromStackSlot() and storeRegToStackSlot(). VRegs can be used here which makes it straightforward, but special sequences needed (without using VSTE/VLE). - __fp16: HalfArgsAndReturns=true

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-11-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: LGTM, but maybe also update the FIXME comment in the original version of CreateRuntimeFunction(). https://github.com/llvm/llvm-project/pull/113506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-11-06 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 closed https://github.com/llvm/llvm-project/pull/111740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Fix argument extensions in CGBlocks.cpp (PR #111740)

2024-11-06 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: I will abandon this now since @efriedma-quic's patch (#113506) is the better approach and approved. https://github.com/llvm/llvm-project/pull/111740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-27 Thread Jonas Paulsson via cfe-commits
@@ -1883,6 +1931,10 @@ void SystemZInstrInfo::getLoadStoreOpcodes(const TargetRegisterClass *RC, } else if (RC == &SystemZ::FP128BitRegClass) { LoadOpcode = SystemZ::LX; StoreOpcode = SystemZ::STX; + } else if (RC == &SystemZ::FP16BitRegClass || + RC ==

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-28 Thread Jonas Paulsson via cfe-commits
@@ -1883,6 +1931,10 @@ void SystemZInstrInfo::getLoadStoreOpcodes(const TargetRegisterClass *RC, } else if (RC == &SystemZ::FP128BitRegClass) { LoadOpcode = SystemZ::LX; StoreOpcode = SystemZ::STX; + } else if (RC == &SystemZ::FP16BitRegClass || + RC ==

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-28 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: >> Without vector support, it might make sense to have load/store pseudos with >> an extra GPR def operand, so that these loads/stores can be expanded as a >> PostRA pseudo. Then it would only need handling in one place, but OTOH >> having a second explicit def operand is als

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 edited https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -102,6 +102,7 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM, addRegisterClass(MVT::i32, &SystemZ::GR32BitRegClass); addRegisterClass(MVT::i64, &SystemZ::GR64BitRegClass); if (!useSoftFloat()) { +addRegisterClass(MVT::f16, &SystemZ::FP16

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 edited https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -91,11 +91,28 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo { "-v128:64-a:8:16-n32:64"); } MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 128; + +// True if the backend supports operations on the half LLVM IR type.

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -255,4 +255,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) { } setLibcallName(RTLIB::MULO_I128, nullptr); } + + if (TT.isSystemZ()) { +setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); +setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfs

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -6108,6 +6160,133 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) { return Op; } +SDValue SystemZTargetLowering::LowerFP_EXTEND(SDValue Op, + SelectionDAG &DAG) const { + bool IsStrict = Op->isStrictFPOpco

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -6108,6 +6160,133 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) { return Op; } +SDValue SystemZTargetLowering::LowerFP_EXTEND(SDValue Op, + SelectionDAG &DAG) const { + bool IsStrict = Op->isStrictFPOpco

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
https://github.com/JonPsson1 edited https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -513,11 +514,37 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM, } // Handle floating-point types. + // Promote all f16 operations to float, with some exceptions below. + for (unsigned Opc = 0; Opc < ISD::BUILTIN_OP_END; ++Opc) +setOperati

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
@@ -6285,6 +6465,16 @@ SDValue SystemZTargetLowering::LowerOperation(SDValue Op, return lowerAddrSpaceCast(Op, DAG); case ISD::ROTL: return lowerShift(Op, DAG, SystemZISD::VROTL_BY_SCALAR); + case ISD::FP_EXTEND: +//case ISD::STRICT_FP_EXTEND: JonPss

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-19 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Updated per review. - strict fp-round / fp-extend added with tests. - math functions like fsin promoted instead of expanded to non-existing fsinh. - conversion functions from e.g. f16 -> f64 used instead of separate steps. - __fp16 argument/return values removed (and tests in sy

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-26 Thread Jonas Paulsson via cfe-commits
@@ -513,11 +514,26 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM, } // Handle floating-point types. + // Promote all f16 operations to float, with some exceptions below. + for (unsigned Opc = 0; Opc < ISD::BUILTIN_OP_END; ++Opc) +setOperati

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-11-26 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Improved handling to utilize vector instructions when present. New VR16 regclass, but v8f16 *not* legal. It might make sense to have it as a legal type and e.g. do VL;VST when moving vectors in memory, and also set all vector ops to "Expand". Not sure how trivial that change w

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2024-12-04 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Spill f16 using float instructions into 4-byte stack slots: - Seems to work to use a RegInfoByHwMode to reset the SpillSize for FP16 to 32 bits. By using two HwMode:s, the spill size can still be 16 bits with vector support. - Using new LE16/STE16 opcodes seems easier than ex

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-31 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: rebase https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-09 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Thanks for help - I think I found the way to enable the building of these functions - patch updated. I could now (for the first time? :D ) compile and run a program on SystemZ with _Float16 variables, by using `--rtlib=compiler-rt `with clang. As I am not the expert on FP sem

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-09 Thread Jonas Paulsson via cfe-commits
@@ -446,10 +448,11 @@ ABIArgInfo SystemZABIInfo::classifyArgumentType(QualType Ty) const { // The structure is passed as an unextended integer, a float, or a double. if (isFPArgumentType(SingleElementTy)) { - assert(Size == 32 || Size == 64); + assert(Size =

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-17 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > Both clear_cache and enable_execute_stack should just be empty no-op > functions on our platform. ah - ok. I fixed clear_cache.c, and this also took care of the other test case which was calling it. https://github.com/llvm/llvm-project/pull/109164 __

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-14 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch rebased and updated. -- Saw two failing compiler-rt tests now: ``` Failed Tests (2): Builtins-s390x-linux :: clear_cache_test.c Builtins-s390x-linux :: enable_execute_stack_test.c ``` clear_cache_test.c contains a call to the compiler-rt clear_cache() function. Fr

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-08 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: I was hoping these added lines would enable the conversion functions, but it doesn't seem to work: ``` + if (TT.isSystemZ()) { +setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); +setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfsf2"); + } clang -target s390x-lin

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-08 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > -DLLVM_RUNTIME_TARGETS Thanks. If I use cmake with -DLLVM_RUNTIME_TARGETS=systemz, and then rebuild, I see one more file being built: ``` ninja [6/6] Linking CXX shared library lib/clang/20/lib/s390x-unknown-linux-gnu/libclang_rt.asan.so ``` However it does not seem to be

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-17 Thread Jonas Paulsson via cfe-commits
@@ -179,20 +179,31 @@ bool SystemZABIInfo::isVectorArgumentType(QualType Ty) const { getContext().getTypeSize(Ty) <= 128); } -bool SystemZABIInfo::isFPArgumentType(QualType Ty) const { +// The Size argument will in case of af an overaligned single element struct +//

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-01-14 Thread Jonas Paulsson via cfe-commits
@@ -446,10 +448,11 @@ ABIArgInfo SystemZABIInfo::classifyArgumentType(QualType Ty) const { // The structure is passed as an unextended integer, a float, or a double. if (isFPArgumentType(SingleElementTy)) { - assert(Size == 32 || Size == 64); + assert(Size =

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-14 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > What is needed to move this forward? The review is in progress so this should hopefully land quite soon. https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -229,7 +229,7 @@ class TargetInfo : public TransferrableTargetInfo, bool NoAsmVariants; // True if {|} are normal characters. bool HasLegalHalfType; // True if the backend supports operations on the half // LLVM IR type. - bool HalfArgsAndRetur

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -35,100 +35,96 @@ using namespace llvm; #include "SystemZGenRegisterInfo.inc" const unsigned SystemZMC::GR32Regs[16] = { - SystemZ::R0L, SystemZ::R1L, SystemZ::R2L, SystemZ::R3L, - SystemZ::R4L, SystemZ::R5L, SystemZ::R6L, SystemZ::R7L, - SystemZ::R8L, SystemZ::R9L, Syst

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -65,6 +65,7 @@ void __clear_cache(void *start, void *end) { #elif defined(_WIN32) && (defined(__arm__) || defined(__aarch64__)) FlushInstructionCache(GetCurrentProcess(), start, end - start); #elif defined(__arm__) && !defined(__APPLE__) +#elif defined(__s390__) --

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -179,20 +179,31 @@ bool SystemZABIInfo::isVectorArgumentType(QualType Ty) const { getContext().getTypeSize(Ty) <= 128); } -bool SystemZABIInfo::isFPArgumentType(QualType Ty) const { +// The Size argument will in case of af an overaligned single element struct +//

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-19 Thread Jonas Paulsson via cfe-commits
@@ -6470,6 +6540,84 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) { return Op; } +SDValue SystemZTargetLowering::lowerFP_EXTEND(SDValue Op, + SelectionDAG &DAG) const { + SDValue In = Op.getOperand(Op->isSt

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-19 Thread Jonas Paulsson via cfe-commits
@@ -3830,6 +3876,14 @@ SDValue SystemZTargetLowering::lowerSELECT_CC(SDValue Op, ISD::CondCode CC = cast(Op.getOperand(4))->get(); SDLoc DL(Op); + // SELECT_CC involving f16 will not have the cmp-ops promoted by the + // legalizer, as it will be handled according to the

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-19 Thread Jonas Paulsson via cfe-commits
@@ -255,4 +255,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) { } setLibcallName(RTLIB::MULO_I128, nullptr); } + + if (TT.isSystemZ()) { +setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); +setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfs

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-20 Thread Jonas Paulsson via cfe-commits
@@ -255,4 +255,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) { } setLibcallName(RTLIB::MULO_I128, nullptr); } + + if (TT.isSystemZ()) { +setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); +setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfs

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-20 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch rebased as the handling of libcalls had changed on main. https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-19 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Found one intrinsic that isn't working for f16: - Isel fails: %res = call i32 @llvm.s390.tdc.f16(half %x, i64 123) LLVM ERROR: Cannot select: t9: i32 = SystemZISD::TDC t2, Constant:i64<123> - The SystemZTDC pass seems to work with 'half', but no tests. - The Clang testFPKind d

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -541,11 +543,26 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM, } // Handle floating-point types. + // Promote all f16 operations to float, with some exceptions below. + for (unsigned Opc = 0; Opc < ISD::BUILTIN_OP_END; ++Opc) +setOperati

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-18 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Updated per review. - Wrapping all isel handlings of FP with !useSoftFloat to make sure no custom lowerering may ever use an FP reg. I am not really sure this is needed as the type-legalizer is run before any lowering, but maybe do it just to be sure. - Also found out that a

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-18 Thread Jonas Paulsson via cfe-commits
@@ -6769,11 +6898,20 @@ SystemZTargetLowering::LowerOperationWrapper(SDNode *N, break; } case ISD::BITCAST: { +SDLoc DL(N); SDValue Src = N->getOperand(0); -if (N->getValueType(0) == MVT::i128 && Src.getValueType() == MVT::f128 && -!useSoftFloat())

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -6464,6 +6522,70 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) { return Op; } +SDValue SystemZTargetLowering::lowerFP_EXTEND(SDValue Op, + SelectionDAG &DAG) const { + SDValue In = Op.getOperand(Op->isSt

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-17 Thread Jonas Paulsson via cfe-commits
@@ -6464,6 +6522,70 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) { return Op; } +SDValue SystemZTargetLowering::lowerFP_EXTEND(SDValue Op, + SelectionDAG &DAG) const { + SDValue In = Op.getOperand(Op->isSt

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-18 Thread Jonas Paulsson via cfe-commits
@@ -6769,11 +6898,20 @@ SystemZTargetLowering::LowerOperationWrapper(SDNode *N, break; } case ISD::BITCAST: { +SDLoc DL(N); SDValue Src = N->getOperand(0); -if (N->getValueType(0) == MVT::i128 && Src.getValueType() == MVT::f128 && -!useSoftFloat())

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-03-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > To clarify, the code is calling `__extendhfdf2` then `__truncdfhf2` from > either libgcc or from compiler-rt with your patches, and the compiler-rt > version is incorrect? Could you have it print the intermediate results as u16 > hex (`Op0 + Op1`, `Res2`, `Res`)? Yes, my te

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-03-07 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Thanks for the help. - new file extendhfdf2.c (and added to GENERIC_SOURCES list) - $GENERIC_TF_SOURCES added to s390x_SOURCES. This did not work immediately. However, if I removed the check for COMPILER_RT_HAS_FLOAT16 in the source files, it builds. Not sure why/if that is n

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-03-09 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: > > If this is not set, you need to figure out why it is not using the correct > host compiler. I think it should be using the clang built from the same > sources, which _should_ now support `_Float16` - if it doesn't, this may > cause other problems, potentially even explain

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-03-09 Thread Jonas Paulsson via cfe-commits
@@ -0,0 +1,27 @@ +//===-- lib/extendhfdf2.c - half -> single conversion -*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-03-13 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: -- A few more tests added covering alloca access into aggregate type with half elements with getelementptr. atomicrmw Would a test for { half, half, half, half } in Swift-return.ll make sense? I think testing coverage now is fairly ok - can't think of any more instructions to

<    1   2   3   >