[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-28 Thread via cfe-commits
https://github.com/joaosaffran closed https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-28 Thread via cfe-commits
@@ -5460,9 +5460,8 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { return getOrCreateOpaqueLValueMapping(e); } -void CodeGenFunction::EmitHLSLOutArgExpr(const HLSLOutArgExpr *E, - CallArgList &Args, QualTy

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-26 Thread Justin Bogner via cfe-commits
@@ -5897,7 +5897,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // Emit any call-associated writebacks immediately. Arguably this // should happen after any return-value munging. if (CallArgs.hasWritebacks()) -emitWritebacks(*this, CallArgs);

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. A few last minor nitpicks, but this LGTM! https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-26 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,77 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 bogner wrote: Are these assertions actually autogenerated? They look like they've been written by hand to me (which is fine, but if that's the case

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-26 Thread Justin Bogner via cfe-commits
@@ -5460,9 +5460,8 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { return getOrCreateOpaqueLValueMapping(e); } -void CodeGenFunction::EmitHLSLOutArgExpr(const HLSLOutArgExpr *E, - CallArgList &Args, QualTy

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,126 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,99 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Justin Bogner via cfe-commits
@@ -95,6 +99,126 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Farzon Lotfi via cfe-commits
@@ -95,6 +99,125 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,133 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -verify + +void test_no_second_arg(double D) { + __builtin_hlsl_elementwise_splitdouble(D); + // expected-error@-1 {{too few arguments to function call, exp

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -verify + +void test_no_second_arg(double D) { + __builtin_hlsl_elementwise_splitdouble(D); + // expected-error@-1 {{too few arguments to function call, exp

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d requested changes to this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. LGTM. Please address the issue linking and Tex's testing requests. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Farzon Lotfi via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,19 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_elementwise_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +if (Che

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,99 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,133 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -1698,18 +1698,27 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { return true; } -static bool CheckArgsTypesAreCorrect( +bool CheckArgTypeIsCorrect( +Sema *S, Expr *Arg, QualType ExpectedType, +llvm::function_ref Check) { + QualType Passe

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -4197,7 +4198,7 @@ static void emitWriteback(CodeGenFunction &CGF, // Release the old value. CGF.EmitARCRelease(oldValue, srcLV.isARCPreciseLifetime()); - // Otherwise, we can just do a normal lvalue store. +// Otherwise, we can just do a normal lvalue store. -

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread via cfe-commits
@@ -0,0 +1,54 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. + +; CH

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,54 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. + +; CH

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ; RUN: opt -passes='function(scalarizer)' -S -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s +; RUN: opt -passes='function(scalarizer),module(dxil-op-lower

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -36,6 +37,11 @@ define noundef <3 x i32> @test_vector_double_split(<3 x double> noundef %d) { ; CHECK-NEXT:[[DOTUPTO116:%.*]] = insertelement <3 x i32> [[DOTUPTO015]], i32 [[DOTI1]], i64 1 ; CHECK-NEXT:[[TMP1:%.*]] = insertelement <3 x i32> [[DOTUPTO116]], i32 [[DO

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Farzon Lotfi via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. + +; CH

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,102 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-l

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,35 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_elementwise_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +Expr *O

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -5149,6 +5152,9 @@ class CodeGenFunction : public CodeGenTypeCache { SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum); + /// EmitWriteback - Emit callbacks for function. + void EmitWritebacks(CodeGenFunction

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -4681,6 +4676,12 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const { IsUsed = true; } +void CodeGenFunction::EmitWritebacks(CodeGenFunction &CGF, + const CallArgList &args) { + for (const auto &I : args.writebacks())

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,157 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,15 @@ +; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s + +; DXIL operation splitdouble doesn't support vector types. + +define noundef <3 x i32> @test_vector_double_split(<3 x double> noundef %D) local_unnamed_addr { +en

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-21 Thread via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-21 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,15 @@ +; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s + +; DXIL operation splitdouble doesn't support vector types. +; XFAIL: * + +define noundef <3 x i32> @test_vector_double_split(<3 x double> noundef %D) loc

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. ---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -1698,18 +1698,27 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { return true; } -static bool CheckArgsTypesAreCorrect( +bool CheckArgTypeIsIncorrect( tex3d wrote: This switches the naming pattern from the existing convention. W

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. ---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -438,6 +438,24 @@ template constexpr uint asuint(T F) { return __detail::bit_cast(F); } +//===--===// +// asuint splitdouble builtins +//===---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -4871,6 +4871,12 @@ def HLSLRadians : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLSplitDouble: LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_splitdouble"]; tex3d wrote: Are we inconsistent on the use of "elementwis

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,35 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +Expr *Op0 = TheCall

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { tex3d wrote: This is quite a

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -4681,6 +4601,87 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const { IsUsed = true; } +/// Emit the actual writing-back of a writeback. +void CodeGenFunction::EmitWriteback(CodeGenFunction &CGF, tex3d wrote: Moving this function makes

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -5149,6 +5152,12 @@ class CodeGenFunction : public CodeGenTypeCache { SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum); + /// EmitWriteback - Emit callbacks for function. + void EmitWritebacks(CodeGenFunctio

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -489,6 +542,9 @@ class OpLowerer { case Intrinsic::dx_typedBufferStore: HasErrors |= lowerTypedBufferStore(F); break; + case Intrinsic::dx_splitdouble: farzonl wrote: `replaceFunctionWithNamedStructOp` seems like the right way to

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
farzonl wrote: PR looks good. CGBuiltin.cpp were minor fix requests. If we are going to revisit the DXILOpLowering.cpp I'd like to see an issue number to track the work. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list c

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Farzon Lotfi via cfe-commits
@@ -18957,6 +18957,134 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-16 Thread via cfe-commits
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -461,6 +479,27 @@ class OpLowerer { }); } + [[nodiscard]] bool lowerSplitDouble(Function &F) { +IRBuilder<> &IRB = OpBuilder.getIRB(); +return replaceFunction(F, [&](CallInst *CI) -> Error { + IRB.SetInsertPoint(CI); + + Value *Arg0 = CI->getArgOper

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -47,6 +47,7 @@ def ResRetInt32Ty : DXILOpParamType; def HandleTy : DXILOpParamType; def ResBindTy : DXILOpParamType; def ResPropsTy : DXILOpParamType; +def ResSplitDoubleTy : DXILOpParamType; bogner wrote: This should just be "SplitDoubleTy". The types that

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -264,6 +264,24 @@ class OpLowerer { return lowerToBindAndAnnotateHandle(F); } + Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) { +IRBuilder<> &IRB = OpBuilder.getIRB(); + +for (Use &U : make_early_inc_range(Intrin->uses())) { + if (au

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -4681,6 +4682,14 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const { IsUsed = true; } +void CodeGenFunction::EmitWritebacks(CodeGenFunction &CGF, + const CallArgList &Args) { + if (getTarget().getCXXABI().areArgsDest

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Justin Bogner via cfe-commits
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Farzon Lotfi via cfe-commits
@@ -461,6 +479,27 @@ class OpLowerer { }); } + [[nodiscard]] bool lowerSplitDouble(Function &F) { +IRBuilder<> &IRB = OpBuilder.getIRB(); +return replaceFunction(F, [&](CallInst *CI) -> Error { + IRB.SetInsertPoint(CI); + + Value *Arg0 = CI->getArgOper

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread via cfe-commits
@@ -461,6 +479,27 @@ class OpLowerer { }); } + [[nodiscard]] bool lowerSplitDouble(Function &F) { +IRBuilder<> &IRB = OpBuilder.getIRB(); +return replaceFunction(F, [&](CallInst *CI) -> Error { + IRB.SetInsertPoint(CI); + + Value *Arg0 = CI->getArgOper

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Farzon Lotfi via cfe-commits
@@ -18901,6 +18901,160 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + // This should only be called when targeting DXIL + case Builtin::BI__builtin_hlsl_splitdou

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread Farzon Lotfi via cfe-commits
@@ -461,6 +479,27 @@ class OpLowerer { }); } + [[nodiscard]] bool lowerSplitDouble(Function &F) { +IRBuilder<> &IRB = OpBuilder.getIRB(); +return replaceFunction(F, [&](CallInst *CI) -> Error { + IRB.SetInsertPoint(CI); + + Value *Arg0 = CI->getArgOper

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread via cfe-commits
@@ -18901,6 +18901,160 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + // This should only be called when targeting DXIL + case Builtin::BI__builtin_hlsl_splitdou

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-09 Thread via cfe-commits
@@ -489,6 +542,9 @@ class OpLowerer { case Intrinsic::dx_typedBufferStore: HasErrors |= lowerTypedBufferStore(F); break; + case Intrinsic::dx_splitdouble: joaosaffran wrote: I will resolve this conversation, since that is a topic we

  1   2   >