[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-31 Thread LLVM Continuous Integration via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: 


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`clang-ppc64le-linux-multistage` running on `ppc64le-clang-multistage-test` 
while building `clang` at step 5 "ninja check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/76/builds/13683


Here is the relevant piece of the build log for the reference

```
Step 5 (ninja check 1) failure: 1200 seconds without output running [b'ninja', 
b'check-all'], attempting to kill
...
PASS: lit :: xfail-cl.py (105109 of 105118)
PASS: lit :: shtest-shell.py (105110 of 105118)
PASS: LLVM :: tools/llvm-readobj/ELF/file-headers.test (105111 of 105118)
PASS: lit :: unique-output-file.py (105112 of 105118)
PASS: lit :: diff-test-update.py (105113 of 105118)
PASS: lit :: verbosity.py (105114 of 105118)
PASS: lit :: discovery.py (105115 of 105118)
PASS: LLVM :: tools/llvm-pdbutil/symbol-offset.test (105116 of 105118)
PASS: lit :: shtest-define.py (105117 of 105118)
PASS: LLVM :: tools/llvm-readobj/ELF/stack-sizes.test (105118 of 105118)
command timed out: 1200 seconds without output running [b'ninja', 
b'check-all'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=6600.456632

```



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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-31 Thread LLVM Continuous Integration via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: 


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `sanitizer-windows` running 
on `sanitizer-windows` while building `clang` at step 7 
"test-build-unified-tree-check-compiler-rt".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/107/builds/16387


Here is the relevant piece of the build log for the reference

```
Step 7 (test-build-unified-tree-check-compiler-rt) failure: test (failure)
 TEST 'SanitizerCommon-Unit :: 
./Sanitizer-x86_64-Test.exe/18/22' FAILED 
Script(shard):
--
GTEST_OUTPUT=json:C:\b\slave\sanitizer-windows\build\runtimes\runtimes-bins\compiler-rt\lib\sanitizer_common\tests\.\Sanitizer-x86_64-Test.exe-SanitizerCommon-Unit-5380-18-22.json
 GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=22 GTEST_SHARD_INDEX=18 
C:\b\slave\sanitizer-windows\build\runtimes\runtimes-bins\compiler-rt\lib\sanitizer_common\tests\.\Sanitizer-x86_64-Test.exe
--

Script:
--
C:\b\slave\sanitizer-windows\build\runtimes\runtimes-bins\compiler-rt\lib\sanitizer_common\tests\.\Sanitizer-x86_64-Test.exe
 --gtest_filter=StopTheWorld.SuspendThreadsAdvanced
--
C:/b/slave/sanitizer-windows/llvm-project/compiler-rt/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cpp(144):
 error: Value of: argument.threads_stopped
  Actual: false
Expected: true


C:/b/slave/sanitizer-windows/llvm-project/compiler-rt/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cpp:144
Value of: argument.threads_stopped
  Actual: false
Expected: true






```



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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-31 Thread LLVM Continuous Integration via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: 


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`sanitizer-x86_64-linux-android` running on `sanitizer-buildbot-android` while 
building `clang` at step 2 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/186/builds/15085


Here is the relevant piece of the build log for the reference

```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
[   OK ] AddressSanitizer.AtoiAndFriendsOOBTest (2299 ms)
[ RUN  ] AddressSanitizer.HasFeatureAddressSanitizerTest
[   OK ] AddressSanitizer.HasFeatureAddressSanitizerTest (0 ms)
[ RUN  ] AddressSanitizer.CallocReturnsZeroMem
[   OK ] AddressSanitizer.CallocReturnsZeroMem (9 ms)
[ DISABLED ] AddressSanitizer.DISABLED_TSDTest
[ RUN  ] AddressSanitizer.IgnoreTest
[   OK ] AddressSanitizer.IgnoreTest (0 ms)
[ RUN  ] AddressSanitizer.SignalTest
[   OK ] AddressSanitizer.SignalTest (177 ms)
[ RUN  ] AddressSanitizer.ReallocTest
[   OK ] AddressSanitizer.ReallocTest (28 ms)
[ RUN  ] AddressSanitizer.WrongFreeTest
[   OK ] AddressSanitizer.WrongFreeTest (119 ms)
[ RUN  ] AddressSanitizer.LongJmpTest
[   OK ] AddressSanitizer.LongJmpTest (0 ms)
[ RUN  ] AddressSanitizer.ThreadStackReuseTest
[   OK ] AddressSanitizer.ThreadStackReuseTest (8 ms)
[ DISABLED ] AddressSanitizer.DISABLED_MemIntrinsicUnalignedAccessTest
[ DISABLED ] AddressSanitizer.DISABLED_LargeFunctionSymbolizeTest
[ DISABLED ] AddressSanitizer.DISABLED_MallocFreeUnwindAndSymbolizeTest
[ RUN  ] AddressSanitizer.UseThenFreeThenUseTest
[   OK ] AddressSanitizer.UseThenFreeThenUseTest (127 ms)
[ RUN  ] AddressSanitizer.FileNameInGlobalReportTest
[   OK ] AddressSanitizer.FileNameInGlobalReportTest (133 ms)
[ DISABLED ] AddressSanitizer.DISABLED_StressStackReuseAndExceptionsTest
[ RUN  ] AddressSanitizer.MlockTest
[   OK ] AddressSanitizer.MlockTest (0 ms)
[ DISABLED ] AddressSanitizer.DISABLED_DemoThreadedTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoStackTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoThreadStackTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFLowIn
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFLowLeft
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFLowRight
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFHigh
[ DISABLED ] AddressSanitizer.DISABLED_DemoOOM
[ DISABLED ] AddressSanitizer.DISABLED_DemoDoubleFreeTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoNullDerefTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoFunctionStaticTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoTooMuchMemoryTest
[ RUN  ] AddressSanitizer.LongDoubleNegativeTest
[   OK ] AddressSanitizer.LongDoubleNegativeTest (0 ms)
[--] 19 tests from AddressSanitizer (27427 ms total)

[--] Global test environment tear-down
[==] 22 tests from 2 test suites ran. (27429 ms total)
[  PASSED  ] 22 tests.

  YOU HAVE 1 DISABLED TEST

Step 34 (run instrumented asan tests 
[aarch64/bluejay-userdebug/TQ3A.230805.001]) failure: run instrumented asan 
tests [aarch64/bluejay-userdebug/TQ3A.230805.001] (failure)
...
[ RUN  ] AddressSanitizer.HasFeatureAddressSanitizerTest
[   OK ] AddressSanitizer.HasFeatureAddressSanitizerTest (0 ms)
[ RUN  ] AddressSanitizer.CallocReturnsZeroMem
[   OK ] AddressSanitizer.CallocReturnsZeroMem (9 ms)
[ DISABLED ] AddressSanitizer.DISABLED_TSDTest
[ RUN  ] AddressSanitizer.IgnoreTest
[   OK ] AddressSanitizer.IgnoreTest (0 ms)
[ RUN  ] AddressSanitizer.SignalTest
[   OK ] AddressSanitizer.SignalTest (177 ms)
[ RUN  ] AddressSanitizer.ReallocTest
[   OK ] AddressSanitizer.ReallocTest (28 ms)
[ RUN  ] AddressSanitizer.WrongFreeTest
[   OK ] AddressSanitizer.WrongFreeTest (119 ms)
[ RUN  ] AddressSanitizer.LongJmpTest
[   OK ] AddressSanitizer.LongJmpTest (0 ms)
[ RUN  ] AddressSanitizer.ThreadStackReuseTest
[   OK ] AddressSanitizer.ThreadStackReuseTest (8 ms)
[ DISABLED ] AddressSanitizer.DISABLED_MemIntrinsicUnalignedAccessTest
[ DISABLED ] AddressSanitizer.DISABLED_LargeFunctionSymbolizeTest
[ DISABLED ] AddressSanitizer.DISABLED_MallocFreeUnwindAndSymbolizeTest
[ RUN  ] AddressSanitizer.UseThenFreeThenUseTest
[   OK ] AddressSanitizer.UseThenFreeThenUseTest (127 ms)
[ RUN  ] AddressSanitizer.FileNameInGlobalReportTest
[   OK ] AddressSanitizer.FileNameInGlobalReportTest (133 ms)
[ DISABLED ] AddressSanitizer.DISABLED_StressStackReuseAndExceptionsTest
[ RUN  ] AddressSanitizer.MlockTest
[   OK ] AddressSanitizer.MlockTest (0 ms)
[ DISABLED ] AddressSanitizer.DISABLED_DemoThreadedTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoStackTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoThreadStackTest
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFLowIn
[ DISABLED ] AddressSanitizer.DISABLED_DemoUAFLowLeft
[ DIS

[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-31 Thread Juan Manuel Martinez Caamaño via cfe-commits

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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-30 Thread Matt Arsenault via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caama=C3=B1o?=
Message-ID:
In-Reply-To: 


https://github.com/arsenm approved this pull request.


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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-30 Thread via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: 


llvmbot wrote:




@llvm/pr-subscribers-backend-amdgpu

Author: Juan Manuel Martinez Caamaño (jmmartinez)


Changes

Allows for type checking depending on the built-in signature.

There is no `f32` version for both builtins.

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


3 Files Affected:

- (modified) clang/include/clang/Basic/BuiltinsAMDGPU.def (+2-2) 
- (added) clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip (+22) 
- (added) clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip (+22) 


``diff
diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def 
b/clang/include/clang/Basic/BuiltinsAMDGPU.def
index c4eb91af7933f..37bc4738302b7 100644
--- a/clang/include/clang/Basic/BuiltinsAMDGPU.def
+++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def
@@ -269,8 +269,8 @@ TARGET_BUILTIN(__builtin_amdgcn_fmed3h, "", "nc", 
"gfx9-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f64, "dd*1d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f32, "ff*1f", "", 
"atomic-fadd-rtn-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_v2f16, "V2hV2h*1V2h", "t", 
"atomic-buffer-global-pk-add-f16-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "t", 
"gfx90a-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "t", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "", 
"gfx90a-insts")
 
 TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fadd_f64, "dd*0d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fmin_f64, "dd*0d", "", 
"gfx90a-insts")
diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
new file mode 100644
index 0..f04c6e3221bcd
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmax_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmax_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val, 0); // 
expected-error{{too many arguments to function call, expected 2, have 3}}
+  result = __builtin_amdgcn_global_atomic_fmax_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr_f, val); // 
expected-error{{cannot initialize a parameter of type}}
+}
diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
new file mode 100644
index 0..3a63d513113b4
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmin_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmin_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val, 0); // 
expected-error{{too many arguments to function call, expected 2, have 3}}
+  result = __builtin_amdgcn_global_atomic_fmin_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr_f, val); // 
expected-error{{cannot initialize a parameter of type}}
+}

``




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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-30 Thread via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: 


llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Juan Manuel Martinez Caamaño (jmmartinez)


Changes

Allows for type checking depending on the built-in signature.

There is no `f32` version for both builtins.

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


3 Files Affected:

- (modified) clang/include/clang/Basic/BuiltinsAMDGPU.def (+2-2) 
- (added) clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip (+22) 
- (added) clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip (+22) 


``diff
diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def 
b/clang/include/clang/Basic/BuiltinsAMDGPU.def
index c4eb91af7933f..37bc4738302b7 100644
--- a/clang/include/clang/Basic/BuiltinsAMDGPU.def
+++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def
@@ -269,8 +269,8 @@ TARGET_BUILTIN(__builtin_amdgcn_fmed3h, "", "nc", 
"gfx9-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f64, "dd*1d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f32, "ff*1f", "", 
"atomic-fadd-rtn-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_v2f16, "V2hV2h*1V2h", "t", 
"atomic-buffer-global-pk-add-f16-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "t", 
"gfx90a-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "t", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "", 
"gfx90a-insts")
 
 TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fadd_f64, "dd*0d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fmin_f64, "dd*0d", "", 
"gfx90a-insts")
diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
new file mode 100644
index 0..f04c6e3221bcd
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmax_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmax_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val, 0); // 
expected-error{{too many arguments to function call, expected 2, have 3}}
+  result = __builtin_amdgcn_global_atomic_fmax_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr_f, val); // 
expected-error{{cannot initialize a parameter of type}}
+}
diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
new file mode 100644
index 0..3a63d513113b4
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmin_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmin_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val, 0); // 
expected-error{{too many arguments to function call, expected 2, have 3}}
+  result = __builtin_amdgcn_global_atomic_fmin_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr_f, val); // 
expected-error{{cannot initialize a parameter of type}}
+}

``




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


[clang] [Clang] Remove 't' from __builtin_amdgcn_global_atomic_fmin/fmax_f64 (PR #173969)

2025-12-30 Thread Juan Manuel Martinez Caamaño via cfe-commits

https://github.com/jmmartinez created 
https://github.com/llvm/llvm-project/pull/173969

Allows for type checking depending on the built-in signature.

There is no `f32` version for both builtins.

From 956bda1c3e633c81d507895a427fe95d19c0ad87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?=
 
Date: Tue, 30 Dec 2025 09:50:38 +0100
Subject: [PATCH 1/2] Pre-commit tests: [Clang] Remove 't' from
 __builtin_amdgcn_global_atomic_fmin/fmax_f64

---
 .../SemaHIP/amdgpu-global-atomic-fmax-err.hip | 23 +++
 .../SemaHIP/amdgpu-global-atomic-fmin-err.hip | 23 +++
 2 files changed, 46 insertions(+)
 create mode 100644 clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
 create mode 100644 clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip

diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
new file mode 100644
index 0..633b3649cd608
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+// expected-no-diagnostics
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmax_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmax_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr, val, 0);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmax_f64(ptr_f, val);
+}
diff --git a/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip 
b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
new file mode 100644
index 0..9cc1e4d31807e
--- /dev/null
+++ b/clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s 
-fcuda-is-device
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
+// expected-no-diagnostics
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+__device__ double global_double;
+
+__device__ void test_global_atomic_fmin_f64_valid(double *ptr, double val) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(&global_double, val);
+}
+
+__device__ void test_global_atomic_fmin_f64_errors(double *ptr, double val,
+   __shared__ double *lds_ptr,
+   float *ptr_f) {
+  double result;
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr, val, 0);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(lds_ptr, val);
+  result = __builtin_amdgcn_global_atomic_fmin_f64(ptr_f, val);
+}

From 7e24e86dedd9ad86c64b5ff94edf1de0e3b973e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?=
 
Date: Tue, 30 Dec 2025 09:47:08 +0100
Subject: [PATCH 2/2] [Clang] Remove 't' from
 __builtin_amdgcn_global_atomic_fmin/fmax_f64

---
 clang/include/clang/Basic/BuiltinsAMDGPU.def | 4 ++--
 clang/test/SemaHIP/amdgpu-global-atomic-fmax-err.hip | 5 ++---
 clang/test/SemaHIP/amdgpu-global-atomic-fmin-err.hip | 5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def 
b/clang/include/clang/Basic/BuiltinsAMDGPU.def
index c4eb91af7933f..37bc4738302b7 100644
--- a/clang/include/clang/Basic/BuiltinsAMDGPU.def
+++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def
@@ -269,8 +269,8 @@ TARGET_BUILTIN(__builtin_amdgcn_fmed3h, "", "nc", 
"gfx9-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f64, "dd*1d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_f32, "ff*1f", "", 
"atomic-fadd-rtn-insts")
 TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_v2f16, "V2hV2h*1V2h", "t", 
"atomic-buffer-global-pk-add-f16-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "t", 
"gfx90a-insts")
-TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "t", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmin_f64, "dd*1d", "", 
"gfx90a-insts")
+TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fmax_f64, "dd*1d", "", 
"gfx90a-insts")
 
 TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fadd_f64, "dd*0d", "", 
"gfx90a-insts")
 TARGET_BUILTIN(__builtin_amdgcn_flat_a