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

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.

Reviewed By: hubert.reinterpretcast, jsji

Differential Revision: https://reviews.llvm.org/D121441
This commit is contained in:
Kai Luo 2022-03-18 12:57:55 +08:00
parent 1a70febf82
commit 9247145fba
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// RUN: %clang_cc1 -verify -triple powerpc-unknown-unknown -emit-llvm -o - %s | \
// RUN: FileCheck %s --check-prefixes=PPC,PPC32
// RUN: %clang_cc1 -verify -triple powerpc64le-unknown-linux -emit-llvm -o - %s | \
// RUN: FileCheck %s --check-prefixes=PPC,PPC64
// RUN: %clang_cc1 -verify -triple powerpc64-unknown-aix -emit-llvm -o - %s | \
// RUN: FileCheck %s --check-prefixes=PPC,PPC64
// PPC: @c = global i8 0, align 1{{$}}
_Atomic(char) c; // expected-no-diagnostics
// PPC: @s = global i16 0, align 2{{$}}
_Atomic(short) s; // expected-no-diagnostics
// PPC: @i = global i32 0, align 4{{$}}
_Atomic(int) i; // expected-no-diagnostics
// PPC32: @l = global i32 0, align 4{{$}}
// PPC64: @l = global i64 0, align 8{{$}}
_Atomic(long) l; // expected-no-diagnostics
// PPC: @ll = global i64 0, align 8{{$}}
_Atomic(long long) ll; // expected-no-diagnostics
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; // expected-no-diagnostics
typedef struct {
char x[16];
} Q;
// PPC: @q = global %struct.Q zeroinitializer, align 1{{$}}
_Atomic(Q) q; // expected-no-diagnostics

View File

@ -4,6 +4,12 @@
// 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=powerpc64-linux-gnu -std=c11 \
// RUN: -target-cpu pwr7
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
// RUN: -fsyntax-only -triple=powerpc64le-linux-gnu -std=c11 \
// RUN: -target-cpu pwr8
// Basic parsing/Sema tests for __c11_atomic_*