================
@@ -0,0 +1,186 @@
+; RUN: llc -march=bpfel -mcpu=v3 -filetype=asm -o - %s | FileCheck 
-check-prefixes=CHECK %s
+; RUN: llc -march=bpfeb -mcpu=v3 -filetype=asm -o - %s | FileCheck 
-check-prefixes=CHECK %s
+;
+; Source:
+;   #include <stdatomic.h>
+;   struct gstruct_t {
+;     _Atomic int a;
+;   } gstruct;
+;   extern _Atomic int ext;
+;   _Atomic int gbl;
+;   _Atomic int *pgbl;
+;   volatile _Atomic int vvar;
+;   _Atomic int foo(_Atomic int a1, _Atomic int *p1) {
+;     (void)__c11_atomic_fetch_add(&gstruct.a, 1, memory_order_relaxed);
+;     (void)__c11_atomic_fetch_add(&ext, 1, memory_order_relaxed);
+;     (void)__c11_atomic_fetch_add(&gbl, 1, memory_order_relaxed);
+;     (void)__c11_atomic_fetch_add(pgbl, 1, memory_order_relaxed);
+;     (void)__c11_atomic_fetch_add(&vvar, 1, memory_order_relaxed);
+;     (void)__c11_atomic_fetch_add(p1, 1, memory_order_relaxed);
+;
+;     return a1;
+;   }
+
+target triple = "bpf"
+
+%struct.gstruct_t = type { i32 }
+
+@gstruct = dso_local global %struct.gstruct_t zeroinitializer, align 4, !dbg !0
+@ext = external dso_local global i32, align 4, !dbg !26
+@gbl = dso_local global i32 0, align 4, !dbg !16
+@pgbl = dso_local local_unnamed_addr global ptr null, align 8, !dbg !20
+@vvar = dso_local global i32 0, align 4, !dbg !23
+
+; Function Attrs: mustprogress nofree norecurse nounwind willreturn
+define dso_local i32 @foo(i32 returned %a1, ptr nocapture noundef %p1) 
local_unnamed_addr #0 !dbg !37 {
+entry:
+    #dbg_value(i32 %a1, !41, !DIExpression(), !43)
+    #dbg_value(ptr %p1, !42, !DIExpression(), !43)
+  %0 = atomicrmw add ptr @gstruct, i32 1 monotonic, align 4, !dbg !44
+  %1 = atomicrmw add ptr @ext, i32 1 monotonic, align 4, !dbg !45
+  %2 = atomicrmw add ptr @gbl, i32 1 monotonic, align 4, !dbg !46
+  %3 = load ptr, ptr @pgbl, align 8, !dbg !47, !tbaa !48
+  %4 = atomicrmw add ptr %3, i32 1 monotonic, align 4, !dbg !52
+  %5 = atomicrmw volatile add ptr @vvar, i32 1 monotonic, align 4, !dbg !53
+  %6 = atomicrmw add ptr %p1, i32 1 monotonic, align 4, !dbg !54
+  ret i32 %a1, !dbg !55
+}
+
+; CHECK:             .long   1                               # BTF_KIND_INT(id 
= 1)
----------------
yonghong-song wrote:

No problem. Let me fix it.

https://github.com/llvm/llvm-project/pull/107343
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to