2 Commits

Author SHA1 Message Date
Chris B
fa4a631fc6
[NFC] [HLSL] Update test for HLSL 202x (#108097)
HLSL 202x inherits from C++11, which generates additional loop hint
information for loops that must progress. Since HLSL 202x is going to be
the default for Clang we want to make sure all our tests pass with it.

Required for https://github.com/llvm/llvm-project/issues/108044
2024-09-11 11:49:44 -05:00
Farzon Lotfi
92fc1eb0c1
[HLSL] add loop unroll (#93879)
spec: https://github.com/microsoft/hlsl-specs/pull/263

- `Attr.td` - Define the HLSL loop attribute hints (unroll and loop)
- `AttrDocs.td` - Add documentation for unroll and loop
- `CGLoopInfo.cpp` - Add codegen for HLSL unroll that maps to clang
unroll expectations
- `ParseStmt.cpp` - For statements if HLSL define DeclSpecAttrs via
MaybeParseMicrosoftAttributes
- `SemaStmtAttr.cpp` - Add the HLSL loop unroll handeling

resolves #70114

dxc examples: 
- for loop: https://hlsl.godbolt.org/z/8EK6Pa139
- while loop:  https://hlsl.godbolt.org/z/ebr5MvEcK
- do while: https://hlsl.godbolt.org/z/be8cedoTs 

Documentation:

![Screenshot_20240531_143000](https://github.com/llvm/llvm-project/assets/1802579/9da9df9b-68a6-49eb-9d4f-e080aa2eff7f)
2024-07-11 17:08:13 -04:00