9 Commits

Author SHA1 Message Date
Steven Perron
a027eb4472
[HLSL] Use hidden visibility for external linkage. (#140292)
Implements

https://github.com/llvm/wg-hlsl/blob/main/proposals/0026-symbol-visibility.md.

The change is to stop using the `hlsl.export` attribute. Instead,
symbols with "program linkage" in HLSL will have export linkage with
default visibility, and symbols with "external linkage" in HLSL will
have export linkage with hidden visibility.
2025-06-16 16:44:55 -04:00
Sarah Spall
561a21f18c
[HLSL] Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and 'max' in own files (#137004)
Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and
'max' in own files which guarantee hlsl version 202x.
Closes #133277
2025-04-28 11:02:11 -07:00
Sarah Spall
25713ed85f
[HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (#129334)
Add additional overloads for min and max to support
min(vector<T,N>, T) and min(T, vector<T,N>)
max(vector<T,N>, T) and max(T, vector<T,N>)
Add tests
Closes #128231
2025-03-03 11:29:58 -08:00
Sarah Spall
762f1b17b2
[HLSL] Make fast math the default for HLSL (#119820)
Make fast math the default for HLSL
Repair test cases broken by this change.
Closes #108597
2025-01-09 08:00:05 -08:00
Greg Roth
c2063de159
Switch DirectX Target to use the Itanium ABI (#111632)
To consolidate behavior of function mangling and limit the number of
places that ABI changes will need to be made, this switches the DirectX
target used for HLSL to use the Itanium ABI from the Microsoft ABI. The
Itanium ABI has greater flexibility in decisions regarding mangling of
new types of which we have more than a few yet to add.

One effect of this will be that linking library shaders compiled with
DXC will not be possible with shaders compiled with clang. That isn't
considered a terribly interesting use case and one that would likely
have been onerous to maintain anyway.

This involved adding a function to call all global destructors as the
Microsoft ABI had done.

This requires a few changes to tests. Most notably the mangling style
has changed which accounts for most of the changes. In making those
changes, I took the opportunity to harmonize some very similar tests for
greater consistency. I also shaved off some unneeded run flags that had
probably been copied over from one test to another.

Other changes effected by using the new ABI include using different
types when manipulating smaller bitfields, eliminating an unnecessary
alloca in one instance in this-assignment.hlsl, changing the way static
local initialization is guarded, and changing the order of inout
parameters getting copied in and out. That last is a subtle change in
functionality, but one where there was sufficient inconsistency in the
past that standardizing is important, but the particular direction of
the standardization is less important for the sake of existing shaders.

fixes #110736
2024-10-10 12:58:28 -06:00
Fangrui Song
f34a5205aa [clang,test] Convert text files from CRLF to LF
Skip files with intentional CRLF line endings.
2024-05-03 10:23:53 -07:00
Farzon Lotfi
c9b1f1c337
[HLSL] standardize builtin unit tests (#83340)
This PR brings best practices mentioned to me on other prs and adds them
to the existing builtin tests.

Note to reviewers: I put this up in two commits because the clang-format
changes is making it hard to tell what actually changed.
use the first commit to check for correctness.
2024-02-29 10:41:40 -08:00
Chris B
e82659fff2
[HLSL] Expose half types and intrinsics always (#81782)
We previously made an implmenetation error when adding `half` overloads
for HLSL library functionalitly. The `half` type is always defined in
HLSL and `half` intrinsics should not be conditionally included.

When native 16-bit types are disabled `half` is a unique 32-bit float
type with lesser promotion rank than `float`.

Fixes #81049
2024-02-15 12:29:22 -06:00
Joshua Batista
7ac0551e77 [HLSL] add max/min library functions
This change exposes the max and min library functions for HLSL, excluding long, and long long doubles.
The max / min functions are supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL.

The full documentation of the HLSL max / min functions are available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-max
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-min

Reviewed By: python3kgae

Differential Revision: https://reviews.llvm.org/D144309
2023-03-03 09:31:50 -08:00