[PATCH] D121441: [PowerPC][NFC] Add atomic alignments and ops tests for powerpc

Kai Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 21:34:05 PST 2022


lkail created this revision.
lkail added reviewers: hubert.reinterpretcast, jsji, xingxue, PowerPC.
Herald added subscribers: steven.zhang, shchenz, nemanjai.
Herald added a project: All.
lkail requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

PowerPC is lacking tests checking `_Atomic` alignment in cfe. Adding these tests since we're going to make change to align with gcc on Linux.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121441

Files:
  clang/test/CodeGen/PowerPC/atomic-alignment.c
  clang/test/Sema/atomic-ops.c


Index: clang/test/Sema/atomic-ops.c
===================================================================
--- clang/test/Sema/atomic-ops.c
+++ clang/test/Sema/atomic-ops.c
@@ -4,6 +4,8 @@
 // RUN:   -fsyntax-only -triple=i686-linux-android -std=c11
 // RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
 // RUN:   -fsyntax-only -triple=powerpc64-linux-gnu -std=c11
+// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
+// RUN:   -fsyntax-only -triple=powerpc64le-linux-gnu -std=c11
 
 // Basic parsing/Sema tests for __c11_atomic_*
 
Index: clang/test/CodeGen/PowerPC/atomic-alignment.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/PowerPC/atomic-alignment.c
@@ -0,0 +1,38 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -verify -triple powerpc-unkonwn-unknown -emit-llvm -o - %s | \
+// RUN:   FileCheck %s --check-prefixes=PPC,PPC32
+// RUN: %clang_cc1 -verify -triple powerpc64le-unkonwn-linux -emit-llvm -o - %s | \
+// RUN:   FileCheck %s --check-prefixes=PPC,PPC64
+// RUN: %clang_cc1 -verify -triple powerpc64-unkonwn-aix -emit-llvm -o - %s | \
+// RUN:   FileCheck %s --check-prefixes=PPC,PPC64
+
+// PPC: @c = global i8 0, align 1
+_Atomic(char) c;
+
+// PPC: @s = global i16 0, align 2
+_Atomic(short) s;
+
+// PPC: @i = global i32 0, align 4
+_Atomic(int) i;
+
+// PPC32: @l = global i32 0, align 4
+// PPC64: @l = global i64 0, align 8
+_Atomic(long) l;
+
+// PPC: @ll = global i64 0, align 8
+_Atomic(long long) ll;
+
+typedef struct {
+  char x[8];
+} O;
+
+// PPC32: @o = global %struct.O zeroinitializer, align 1
+// PPC64: @o = global %struct.O zeroinitializer, align 8
+_Atomic(O) o;
+
+typedef struct {
+  char x[16];
+} Q;
+
+// PPC: @q = global %struct.Q zeroinitializer, align 1
+_Atomic(Q) q;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121441.414570.patch
Type: text/x-patch
Size: 1820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220311/5de744d7/attachment-0001.bin>


More information about the cfe-commits mailing list