Commit 82acec1
authored
[HLSL] Implementation of dot intrinsic (llvm#81190)
This change implements llvm#70073
HLSL has a dot intrinsic defined here:
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-dot
The intrinsic itself is defined as a HLSL_LANG LangBuiltin in
Builtins.td.
This is used to associate all the dot product typdef defined
hlsl_intrinsics.h
with a single intrinsic check in CGBuiltin.cpp & SemaChecking.cpp.
In IntrinsicsDirectX.td we define the llvmIR for the dot product.
A few goals were in mind for this IR. First it should operate on only
vectors. Second the return type should be the vector element type. Third
the second parameter vector should be of the same size as the first
parameter. Finally `a dot b` should be the same as `b dot a`.
In CGBuiltin.cpp hlsl has built on top of existing clang intrinsics via
EmitBuiltinExpr. Dot
product though is language specific intrinsic and so is guarded behind
getLangOpts().HLSL.
The call chain looks like this: EmitBuiltinExpr -> EmitHLSLBuiltinExp
EmitHLSLBuiltinExp dot product intrinsics makes a destinction
between vectors and scalars. This is because HLSL supports dot product
on scalars which simplifies down to multiply.
Sema.h & SemaChecking.cpp saw the addition of
CheckHLSLBuiltinFunctionCall, a language specific semantic validation
that can be expanded for other hlsl specific intrinsics.
Fixes llvm#700731 parent b2ebd8b commit 82acec1
File tree
11 files changed
+703
-8
lines changed- clang
- include/clang
- Basic
- Sema
- lib
- CodeGen
- Headers/hlsl
- Sema
- test
- CodeGenHLSL/builtins
- SemaHLSL
- BuiltIns
- llvm/include/llvm/IR
11 files changed
+703
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4524 | 4524 | | |
4525 | 4525 | | |
4526 | 4526 | | |
| 4527 | + | |
| 4528 | + | |
| 4529 | + | |
| 4530 | + | |
| 4531 | + | |
| 4532 | + | |
4527 | 4533 | | |
4528 | 4534 | | |
4529 | 4535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14063 | 14063 | | |
14064 | 14064 | | |
14065 | 14065 | | |
| 14066 | + | |
14066 | 14067 | | |
14067 | 14068 | | |
14068 | 14069 | | |
| |||
14128 | 14129 | | |
14129 | 14130 | | |
14130 | 14131 | | |
| 14132 | + | |
| 14133 | + | |
14131 | 14134 | | |
14132 | 14135 | | |
14133 | 14136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
5982 | 5983 | | |
5983 | 5984 | | |
5984 | 5985 | | |
| 5986 | + | |
| 5987 | + | |
| 5988 | + | |
| 5989 | + | |
5985 | 5990 | | |
5986 | 5991 | | |
5987 | 5992 | | |
| |||
17959 | 17964 | | |
17960 | 17965 | | |
17961 | 17966 | | |
| 17967 | + | |
| 17968 | + | |
| 17969 | + | |
| 17970 | + | |
| 17971 | + | |
| 17972 | + | |
| 17973 | + | |
| 17974 | + | |
| 17975 | + | |
| 17976 | + | |
| 17977 | + | |
| 17978 | + | |
| 17979 | + | |
| 17980 | + | |
| 17981 | + | |
| 17982 | + | |
| 17983 | + | |
| 17984 | + | |
| 17985 | + | |
| 17986 | + | |
| 17987 | + | |
| 17988 | + | |
| 17989 | + | |
| 17990 | + | |
| 17991 | + | |
| 17992 | + | |
| 17993 | + | |
| 17994 | + | |
| 17995 | + | |
| 17996 | + | |
| 17997 | + | |
| 17998 | + | |
| 17999 | + | |
| 18000 | + | |
| 18001 | + | |
| 18002 | + | |
| 18003 | + | |
| 18004 | + | |
| 18005 | + | |
| 18006 | + | |
| 18007 | + | |
| 18008 | + | |
| 18009 | + | |
| 18010 | + | |
| 18011 | + | |
| 18012 | + | |
17962 | 18013 | | |
17963 | 18014 | | |
17964 | 18015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4405 | 4405 | | |
4406 | 4406 | | |
4407 | 4407 | | |
| 4408 | + | |
4408 | 4409 | | |
4409 | 4410 | | |
4410 | 4411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
182 | 280 | | |
183 | 281 | | |
184 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2120 | 2120 | | |
2121 | 2121 | | |
2122 | 2122 | | |
2123 | | - | |
2124 | | - | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
2125 | 2126 | | |
2126 | | - | |
| 2127 | + | |
2127 | 2128 | | |
2128 | 2129 | | |
2129 | 2130 | | |
| |||
2961 | 2962 | | |
2962 | 2963 | | |
2963 | 2964 | | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
2964 | 2968 | | |
2965 | 2969 | | |
2966 | 2970 | | |
| |||
5161 | 5165 | | |
5162 | 5166 | | |
5163 | 5167 | | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
| 5173 | + | |
| 5174 | + | |
| 5175 | + | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
| 5195 | + | |
| 5196 | + | |
| 5197 | + | |
| 5198 | + | |
| 5199 | + | |
| 5200 | + | |
| 5201 | + | |
| 5202 | + | |
| 5203 | + | |
| 5204 | + | |
| 5205 | + | |
| 5206 | + | |
| 5207 | + | |
| 5208 | + | |
| 5209 | + | |
| 5210 | + | |
| 5211 | + | |
| 5212 | + | |
| 5213 | + | |
| 5214 | + | |
| 5215 | + | |
| 5216 | + | |
| 5217 | + | |
| 5218 | + | |
| 5219 | + | |
| 5220 | + | |
| 5221 | + | |
| 5222 | + | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
| 5229 | + | |
| 5230 | + | |
| 5231 | + | |
5164 | 5232 | | |
5165 | 5233 | | |
5166 | 5234 | | |
| |||
19594 | 19662 | | |
19595 | 19663 | | |
19596 | 19664 | | |
19597 | | - | |
| 19665 | + | |
19598 | 19666 | | |
19599 | 19667 | | |
19600 | 19668 | | |
19601 | 19669 | | |
19602 | 19670 | | |
19603 | 19671 | | |
19604 | 19672 | | |
| 19673 | + | |
| 19674 | + | |
| 19675 | + | |
| 19676 | + | |
| 19677 | + | |
| 19678 | + | |
| 19679 | + | |
| 19680 | + | |
| 19681 | + | |
| 19682 | + | |
| 19683 | + | |
| 19684 | + | |
| 19685 | + | |
| 19686 | + | |
| 19687 | + | |
| 19688 | + | |
| 19689 | + | |
| 19690 | + | |
| 19691 | + | |
| 19692 | + | |
| 19693 | + | |
19605 | 19694 | | |
19606 | 19695 | | |
19607 | 19696 | | |
19608 | 19697 | | |
19609 | 19698 | | |
19610 | 19699 | | |
19611 | 19700 | | |
19612 | | - | |
19613 | | - | |
| 19701 | + | |
19614 | 19702 | | |
19615 | 19703 | | |
19616 | 19704 | | |
| |||
19622 | 19710 | | |
19623 | 19711 | | |
19624 | 19712 | | |
19625 | | - | |
| 19713 | + | |
19626 | 19714 | | |
19627 | 19715 | | |
19628 | 19716 | | |
19629 | 19717 | | |
19630 | | - | |
19631 | 19718 | | |
19632 | 19719 | | |
19633 | 19720 | | |
| |||
0 commit comments