brintos

brintos / llvm-project-archived public Read only

0
0
Text · 772 B · 8f272dc Raw
19 lines · plain
1; RUN: opt < %s -S -nvptx-atomic-lower | FileCheck %s2 3; This test ensures that there is a legal way for ptx to lower atomics4; on local memory. Here, we demonstrate this by lowering them to simple5; load and stores.6 7target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"8target triple = "nvptx64-unknown-unknown"9 10define double @kernel(ptr addrspace(5) %ptr, double %val) {11  %res = atomicrmw fadd ptr addrspace(5) %ptr, double %val monotonic, align 812  ret double %res13; CHECK:   %1 = load double, ptr addrspace(5) %ptr, align 814; CHECK-NEXT:   %new = fadd double %1, %val15; CHECK-NEXT:   store double %new, ptr addrspace(5) %ptr, align 816; CHECK-NEXT:   ret double %117}18 19