forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cherrypick to mainline for SWDEV-228246
Let clang atomic builtins fetch add/sub support floating point types Differential Revision: https://reviews.llvm.org/D71726 Change-Id: I5d9fe1fa0ef88dd10d495b6fdf9e63695c48c137
- Loading branch information
Showing
8 changed files
with
105 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \ | ||
// RUN: -fcuda-is-device -target-cpu gfx906 | FileCheck %s | ||
// REQUIRES: amdgpu-registered-target | ||
|
||
#include "Inputs/cuda.h" | ||
#include <stdatomic.h> | ||
|
||
__device__ float ffp1(float *p) { | ||
// CHECK-LABEL: @_Z4ffp1Pf | ||
// CHECK: atomicrmw fadd float* {{.*}} monotonic | ||
return __atomic_fetch_add(p, 1.0f, memory_order_relaxed); | ||
} | ||
|
||
__device__ double ffp2(double *p) { | ||
// CHECK-LABEL: @_Z4ffp2Pd | ||
// CHECK: atomicrmw fsub double* {{.*}} monotonic | ||
return __atomic_fetch_sub(p, 1.0, memory_order_relaxed); | ||
} | ||
|
||
// long double is the same as double for amdgcn. | ||
__device__ long double ffp3(long double *p) { | ||
// CHECK-LABEL: @_Z4ffp3Pe | ||
// CHECK: atomicrmw fsub double* {{.*}} monotonic | ||
return __atomic_fetch_sub(p, 1.0, memory_order_relaxed); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters