Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the atan2 HLSL Function #70096

Open
8 of 14 tasks
Tracked by #99235 ...
llvm-beanz opened this issue Oct 24, 2023 · 1 comment
Open
8 of 14 tasks
Tracked by #99235 ...

Implement the atan2 HLSL Function #70096

llvm-beanz opened this issue Oct 24, 2023 · 1 comment
Assignees
Labels

Comments

@llvm-beanz
Copy link
Collaborator

llvm-beanz commented Oct 24, 2023

Note atan2 has been identified as a potential generic llvm intrinsic:
Investigation: #87367
RFC: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

  • Implement atan2 clang builtin,
  • Link atan2 clang builtin with hlsl_intrinsics.h
  • Add sema checks for atan2 to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for atan2 to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/atan2.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/atan2-errors.hlsl
  • Create the int_atan2 intrinsic in Intrinsics.td
  • Create the int_dx_atan2 intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_atan2 to 17 in DXIL.td
  • Create the atan2.ll and atan2_errors.ll tests in llvm/test/CodeGen/DirectX/
  • Create the int_spv_atan2 intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the atan2 lowering and map it to int_spv_atan2 in SPIRVInstructionSelector::selectIntrinsic.
  • In SPIRVInstructionSelector.cpp: SPIRVInstructionSelector::spvSelect Add
  case TargetOpcode::G_FATAN2:
    return selectExtInst(ResVReg, ResType, I, CL::atan2, GL::Atan2);
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/atan2.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
17 Atan 6.0 ()

SPIR-V

Atan2:

Description:

Atan2

Arc tangent. Result is an angle, in radians, whose tangent is y / x.
The signs of x and y are used to determine what quadrant the angle
is in. The range of result values is [-π, π] . Result is undefined if
x and y are both 0.

The operand x and y must be a scalar or vector whose component type
is 16-bit or 32-bit floating-point.

Result Type and the type of all operands must be the same type.
Results are computed per component.

Number Operand 1 Operand 2 Operand 3 Operand 4

25

<id>
y

<id>
x

Test Case(s)

Example 1

//dxc atan2_test.hlsl -T lib_6_8  -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0

export float4 fn(float4 p1, float4 p2) {
    return atan2(p1, p2);
}

HLSL:

Returns the arctangent of two values (x,y).

ret atan2(y, x)

Parameters

Item Description
y
[in] The y value.
x
[in] The x value.

Return Value

The arctangent of (y,x).

Remarks

The signs of the x and y parameters are used to determine the quadrant of the return values within the range of -π to π. The atan2 HLSL intrinsic function is well-defined for every point other than the origin, even if y equals 0 and x does not equal 0.

Type Description

Name Template Type Component Type Size
y same as input x float same dimension(s) as input x
x scalar, vector, or matrix float any
ret same as input x float same dimension(s) as input x

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) vs_1_1

Requirements

Requirement Value
Header
Corecrt_math.h

See also

Intrinsic Functions (DirectX HLSL)

@llvm-beanz llvm-beanz added the HLSL HLSL Language Support label Oct 24, 2023
@farzonl farzonl changed the title [HLSL] implement atan2 intrinsic Implement the atan2 HLSL Function Jul 16, 2024
@tex3d
Copy link
Contributor

tex3d commented Aug 29, 2024

I can take this one.

tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- Doc updates:
  - `clang/docs/LanguageExtensions.rst' - Document the new elementwise atan2 builtin.
  - `llvm/docs/LangRef.rst' - Document the atan2 intrinsic
- TableGen:
  - `clang/include/clang/Basic/Builtins.td' - Implement the atan2 builtin.
  - `llvm/include/llvm/IR/Intrinsics.td' - Create the atan2 intrinsic
- Sema checking:
  - `clang/lib/Sema/SemaChecking.cpp' - Add generic sema checks to the atan2 builtin
  - `clang/lib/Sema/SemaHLSL` Add HLSL specifc sema checks to the atan2 builtin
- `clang/lib/CodeGen/CGBuiltin.cpp' - invoke the atan2 intrinsic on uses of the builtin
- `clang/lib/Headers/hlsl/hlsl_intrinsics.h' - Associate the atan2 builtin with the equivalent hlsl apis
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode
- `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler
- `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode
- `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode
- `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions.
- `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- Doc updates:
  - `clang/docs/LanguageExtensions.rst` - Document the new elementwise atan2 builtin.
  - `llvm/docs/LangRef.rst` - Document the atan2 intrinsic
- TableGen:
  - `clang/include/clang/Basic/Builtins.td` - Implement the atan2 builtin.
  - `llvm/include/llvm/IR/Intrinsics.td` - Create the atan2 intrinsic
- Sema checking:
  - `clang/lib/Sema/SemaChecking.cpp` - Add generic sema checks to the atan2 builtin
  - `clang/lib/Sema/SemaHLSL` Add HLSL specifc sema checks to the atan2 builtin
- `clang/lib/CodeGen/CGBuiltin.cpp` - invoke the atan2 intrinsic on uses of the builtin
- `clang/lib/Headers/hlsl/hlsl_intrinsics.h` - Associate the atan2 builtin with the equivalent hlsl apis
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode
- `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler
- `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode
- `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode
- `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions.
- `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 9, 2024
Issue: llvm#70096

Changes:
- `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode
- `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler
- `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode
- `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode
- `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions.
- `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 10, 2024
Issue: llvm#70096

Changes:
- Doc updates:
  - `clang/docs/LanguageExtensions.rst` - Document the new elementwise atan2 builtin.
  - `llvm/docs/LangRef.rst` - Document the atan2 intrinsic
- TableGen:
  - `clang/include/clang/Basic/Builtins.td` - Implement the atan2 builtin.
  - `llvm/include/llvm/IR/Intrinsics.td` - Create the atan2 intrinsic
- Sema checking:
  - `clang/lib/Sema/SemaChecking.cpp` - Add generic sema checks to the atan2 builtin
  - `clang/lib/Sema/SemaHLSL` Add HLSL specifc sema checks to the atan2 builtin
- `clang/lib/CodeGen/CGBuiltin.cpp` - invoke the atan2 intrinsic on uses of the builtin
- `clang/lib/Headers/hlsl/hlsl_intrinsics.h` - Associate the atan2 builtin with the equivalent hlsl apis
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 10, 2024
Issue: llvm#70096

Changes:
- `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 10, 2024
Issue: llvm#70096

Changes:
- `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode
- `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler
- `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode
- `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode
- `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions.
- `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 13, 2024
Issue: llvm#70096

Changes:
- `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d added a commit to tex3d/llvm-project that referenced this issue Sep 13, 2024
Issue: llvm#70096

Changes:
- `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode
- `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler
- `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode
- `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode
- `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions.
- `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
farzonl pushed a commit that referenced this issue Sep 24, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function #70096.
farzonl pushed a commit that referenced this issue Sep 25, 2024
#109878)

This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function #70096.

(reland #108865 reverted in #109842 due to doc build break)
bob80905 pushed a commit that referenced this issue Sep 26, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add generic opcode for atan2
- Add SPIRV lowering for atan2

Part 2 for Implement the atan2 HLSL Function #70096.
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Sep 26, 2024
…108865)

This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function llvm#70096.
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Sep 26, 2024
llvm#109878)

This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function llvm#70096.

(reland llvm#108865 reverted in llvm#109842 due to doc build break)
tex3d added a commit that referenced this issue Oct 1, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add HLSL frontend for atan2
- Add clang Builtin, map to new llvm.atan2
- SemaChecking restrict to floating point and 2 args
- SemaHLSL restrict to float or half.
- Add to clang ReleaseNotes.rst and LanguageExtensions.rst
- Add half-float-only-errors2.hlsl for 2 arg intrinsics, and update half-float-only-errors.hlsl with scalar case for consistency
- Remove fmod-errors.hlsl and pow-errors.hlsl now covered in half-float-only-errors2.hlsl

Part 3 for Implement the atan2 HLSL Function #70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 1, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
VitaNuo pushed a commit to VitaNuo/llvm-project that referenced this issue Oct 2, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add HLSL frontend for atan2
- Add clang Builtin, map to new llvm.atan2
- SemaChecking restrict to floating point and 2 args
- SemaHLSL restrict to float or half.
- Add to clang ReleaseNotes.rst and LanguageExtensions.rst
- Add half-float-only-errors2.hlsl for 2 arg intrinsics, and update half-float-only-errors.hlsl with scalar case for consistency
- Remove fmod-errors.hlsl and pow-errors.hlsl now covered in half-float-only-errors2.hlsl

Part 3 for Implement the atan2 HLSL Function llvm#70096.
VitaNuo pushed a commit to VitaNuo/llvm-project that referenced this issue Oct 2, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add HLSL frontend for atan2
- Add clang Builtin, map to new llvm.atan2
- SemaChecking restrict to floating point and 2 args
- SemaHLSL restrict to float or half.
- Add to clang ReleaseNotes.rst and LanguageExtensions.rst
- Add half-float-only-errors2.hlsl for 2 arg intrinsics, and update half-float-only-errors.hlsl with scalar case for consistency
- Remove fmod-errors.hlsl and pow-errors.hlsl now covered in half-float-only-errors2.hlsl

Part 3 for Implement the atan2 HLSL Function llvm#70096.
Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this issue Oct 3, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add HLSL frontend for atan2
- Add clang Builtin, map to new llvm.atan2
- SemaChecking restrict to floating point and 2 args
- SemaHLSL restrict to float or half.
- Add to clang ReleaseNotes.rst and LanguageExtensions.rst
- Add half-float-only-errors2.hlsl for 2 arg intrinsics, and update half-float-only-errors.hlsl with scalar case for consistency
- Remove fmod-errors.hlsl and pow-errors.hlsl now covered in half-float-only-errors2.hlsl

Part 3 for Implement the atan2 HLSL Function llvm#70096.
xgupta pushed a commit to xgupta/llvm-project that referenced this issue Oct 4, 2024
…108865)

This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function llvm#70096.
xgupta pushed a commit to xgupta/llvm-project that referenced this issue Oct 4, 2024
llvm#109878)

This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This preliminary work adds the intrinsic to llvm and expands using atan
intrinsic for DXIL backend, since DXIL has no atan2 op.

Part 1 for Implement the atan2 HLSL Function llvm#70096.

(reland llvm#108865 reverted in llvm#109842 due to doc build break)
xgupta pushed a commit to xgupta/llvm-project that referenced this issue Oct 4, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add generic opcode for atan2
- Add SPIRV lowering for atan2

Part 2 for Implement the atan2 HLSL Function llvm#70096.
xgupta pushed a commit to xgupta/llvm-project that referenced this issue Oct 4, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- Add HLSL frontend for atan2
- Add clang Builtin, map to new llvm.atan2
- SemaChecking restrict to floating point and 2 args
- SemaHLSL restrict to float or half.
- Add to clang ReleaseNotes.rst and LanguageExtensions.rst
- Add half-float-only-errors2.hlsl for 2 arg intrinsics, and update half-float-only-errors.hlsl with scalar case for consistency
- Remove fmod-errors.hlsl and pow-errors.hlsl now covered in half-float-only-errors2.hlsl

Part 3 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 10, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 11, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 15, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 16, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 16, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `Builtins.td` - Add f16 support for libm atan2 builtin
- `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin

Part of Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit that referenced this issue Oct 16, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

Based on example PR #96222 and fix PR #101268, with some differences due
to 2-arg intrinsic and intermediate refactor (RuntimeLibCalls.cpp).

- Add llvm.experimental.constrained.atan2 - Intrinsics.td,
ConstrainedOps.def, LangRef.rst
- Add to ISDOpcodes.h and TargetSelectionDAG.td, connect to intrinsic in
BasicTTIImpl.h, and LibFunc_ in SelectionDAGBuilder.cpp
- Update LegalizeDAG.cpp, LegalizeFloatTypes.cpp, LegalizeVectorOps.cpp,
and LegalizeVectorTypes.cpp
- Update isKnownNeverNaN in SelectionDAG.cpp
- Update SelectionDAGDumper.cpp
- Update libcalls - RuntimeLibcalls.def, RuntimeLibcalls.cpp
- TargetLoweringBase.cpp - Expand for vectors, promote f16
- X86ISelLowering.cpp - Expand f80, promote f32 to f64 for MSVC

Part 4 for Implement the atan2 HLSL Function #70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 16, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 16, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `Builtins.td` - Add f16 support for libm atan2 builtin
- `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin

Part of Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 16, 2024
When updating X86SelLowering.cpp based on llvm#96222, it was known that a needed change was missing which was merged later in llvm#101268.  However, the corresponding test update to `fp-strict-libcalls-msvc32.ll` was missed.

This change rectifies that oversight.

Part of: Part of: Implement the atan2 HLSL Function llvm#70096.
bricknerb pushed a commit to bricknerb/llvm-project that referenced this issue Oct 17, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

Based on example PR llvm#96222 and fix PR llvm#101268, with some differences due
to 2-arg intrinsic and intermediate refactor (RuntimeLibCalls.cpp).

- Add llvm.experimental.constrained.atan2 - Intrinsics.td,
ConstrainedOps.def, LangRef.rst
- Add to ISDOpcodes.h and TargetSelectionDAG.td, connect to intrinsic in
BasicTTIImpl.h, and LibFunc_ in SelectionDAGBuilder.cpp
- Update LegalizeDAG.cpp, LegalizeFloatTypes.cpp, LegalizeVectorOps.cpp,
and LegalizeVectorTypes.cpp
- Update isKnownNeverNaN in SelectionDAG.cpp
- Update SelectionDAGDumper.cpp
- Update libcalls - RuntimeLibcalls.def, RuntimeLibcalls.cpp
- TargetLoweringBase.cpp - Expand for vectors, promote f16
- X86ISelLowering.cpp - Expand f80, promote f32 to f64 for MSVC

Part 4 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit that referenced this issue Oct 17, 2024
When updating X86SelLowering.cpp for atan2, based on #96222, it was
known that a needed change was missing which was merged later in
#101268. However, the corresponding test update to
`fp-strict-libcalls-msvc32.ll` was missed.

This change rectifies that oversight.

This also adds a missing label to the tanh test, since it's produced by
update_llc_test_checks.py

Part of: Implement the atan2 HLSL Function #70096.
tex3d added a commit that referenced this issue Oct 17, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `WebAssemblyRuntimeLibcallSignatures.cpp`: Add `RTLIB::ATAN2*` to
RuntimeLibcallSignatureTable
- Add atan2 calls to `CodeGen/WebAssembly/libcalls-trig.ll` and update
test checks

Part of: Implement the atan2 HLSL Function #70096.
bricknerb pushed a commit to bricknerb/llvm-project that referenced this issue Oct 21, 2024
When updating X86SelLowering.cpp for atan2, based on llvm#96222, it was
known that a needed change was missing which was merged later in
llvm#101268. However, the corresponding test update to
`fp-strict-libcalls-msvc32.ll` was missed.

This change rectifies that oversight.

This also adds a missing label to the tanh test, since it's produced by
update_llc_test_checks.py

Part of: Implement the atan2 HLSL Function llvm#70096.
bricknerb pushed a commit to bricknerb/llvm-project that referenced this issue Oct 21, 2024
This change is part of this proposal:
https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `WebAssemblyRuntimeLibcallSignatures.cpp`: Add `RTLIB::ATAN2*` to
RuntimeLibcallSignatureTable
- Add atan2 calls to `CodeGen/WebAssembly/libcalls-trig.ll` and update
test checks

Part of: Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 21, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `VecFuncs.def`: define intrinsic to sleef/armpl mapping
- `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic
- `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions
- `AArch64LegalizerInfo.cpp`: Legalize atan2.

Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 21, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

- `Builtins.td` - Add f16 support for libm atan2 builtin
- `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin

Part of Implement the atan2 HLSL Function llvm#70096.
tex3d added a commit to tex3d/llvm-project that referenced this issue Oct 21, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294

This returns true from isTriviallyVectorizable for llvm.atan2 intrinsic.
It also adds llvm atan2 intrinsic equivalents to VecFuncs.def for massv.

Part of: Implement the atan2 HLSL Function llvm#70096.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Active
Development

No branches or pull requests

3 participants