llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-hlsl

Author: Kaitlin Peng (kmpeng)

<details>
<summary>Changes</summary>

This PR updates the `atan2` matrix sema error test to cover the full set of 
argument/type error cases (mirroring `pow_mat-errors.hlsl`). It also renames 
two tests to match the `&lt;intrinsic&gt;_mat-&lt;suffix&gt;` convention that 
other intrinsics follow.

---
Full diff: https://github.com/llvm/llvm-project/pull/214550.diff


3 Files Affected:

- (renamed) clang/test/CodeGenHLSL/builtins/atan2_mat-overloads.hlsl () 
- (removed) clang/test/SemaHLSL/BuiltIns/atan2-errors_mat.hlsl (-7) 
- (added) clang/test/SemaHLSL/BuiltIns/atan2_mat-errors.hlsl (+36) 


``````````diff
diff --git a/clang/test/CodeGenHLSL/builtins/atan2-overloads_mat.hlsl 
b/clang/test/CodeGenHLSL/builtins/atan2_mat-overloads.hlsl
similarity index 100%
rename from clang/test/CodeGenHLSL/builtins/atan2-overloads_mat.hlsl
rename to clang/test/CodeGenHLSL/builtins/atan2_mat-overloads.hlsl
diff --git a/clang/test/SemaHLSL/BuiltIns/atan2-errors_mat.hlsl 
b/clang/test/SemaHLSL/BuiltIns/atan2-errors_mat.hlsl
deleted file mode 100644
index 19467d99d2292..0000000000000
--- a/clang/test/SemaHLSL/BuiltIns/atan2-errors_mat.hlsl
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang_cc1 -finclude-default-header -triple 
dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type 
-emit-llvm-only -disable-llvm-passes -verify
-
-
-double2x2 test_vec_double_builtin(double2x2 p0, double2x2 p1) {
-    return __builtin_elementwise_atan2(p0, p1);
-  // expected-error@-1 {{1st argument must be a scalar or vector of 16 or 32 
bit floating-point types (was 'double2x2' (aka 'matrix<double, 2, 2>'))}}
-}
diff --git a/clang/test/SemaHLSL/BuiltIns/atan2_mat-errors.hlsl 
b/clang/test/SemaHLSL/BuiltIns/atan2_mat-errors.hlsl
new file mode 100644
index 0000000000000..78690f74388ad
--- /dev/null
+++ b/clang/test/SemaHLSL/BuiltIns/atan2_mat-errors.hlsl
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -finclude-default-header -triple 
dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type 
-emit-llvm-only -disable-llvm-passes -verify
+
+float2x2 test_too_few_arg(float2x2 p0) {
+  return __builtin_elementwise_atan2(p0);
+  // expected-error@-1 {{too few arguments to function call, expected 2, have 
1}}
+}
+
+float2x2 test_too_many_arg(float2x2 p0) {
+  return __builtin_elementwise_atan2(p0, p0, p0);
+  // expected-error@-1 {{too many arguments to function call, expected 2, have 
3}}
+}
+
+int2x2 test_int_mat(int2x2 p0) {
+  return __builtin_elementwise_atan2(p0, p0);
+  // expected-error@-1 {{1st argument must be a scalar or vector of 
floating-point types (was 'int2x2' (aka 'matrix<int, 2, 2>'))}}
+}
+
+float2x2 test_mismatched_dims(float2x2 p0, float3x3 p1) {
+  return __builtin_elementwise_atan2(p0, p1);
+  // expected-error@-1 {{arguments are of different types ('matrix<[...], 2, 
2>' vs 'matrix<[...], 3, 3>')}}
+}
+
+float2x2 test_mismatched_element_types(float2x2 p0, half2x2 p1) {
+  return __builtin_elementwise_atan2(p0, p1);
+  // expected-error@-1 {{arguments are of different types ('matrix<float, [2 * 
...]>' vs 'matrix<half, [2 * ...]>')}}
+}
+
+float2x2 test_scalar_and_matrix(float p0, float2x2 p1) {
+  return __builtin_elementwise_atan2(p0, p1);
+  // expected-error@-1 {{arguments are of different types ('float' vs 
'float2x2' (aka 'matrix<float, 2, 2>'))}}
+}
+
+float2x2 test_vector_and_matrix(float2 p0, float2x2 p1) {
+  return __builtin_elementwise_atan2(p0, p1);
+  // expected-error@-1 {{arguments are of different types ('float2' (aka 
'vector<float, 2>') vs 'float2x2' (aka 'matrix<float, 2, 2>'))}}
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/214550
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to