This revision was automatically updated to reflect the committed changes. Closed by commit rGf46c41febb88: [SystemZ][z/OS] fix lit test related to alignment (authored by NancyWang2222, committed by muiez). Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98793/new/ https://reviews.llvm.org/D98793 Files: clang/test/AST/alignas_maybe_odr_cleanup.cpp clang/test/CodeGen/PR5060-align.c clang/test/Layout/itanium-union-bitfield.cpp Index: clang/test/Layout/itanium-union-bitfield.cpp =================================================================== --- clang/test/Layout/itanium-union-bitfield.cpp +++ clang/test/Layout/itanium-union-bitfield.cpp @@ -1,15 +1,23 @@ // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s +// On z/OS, a bit-field has single byte alignment. Add aligned(4) on z/OS so the union has +// the same size & alignment as expected. +#ifdef __MVS__ +#define ALIGN4 __attribute__((aligned(4))) +#else +#define ALIGN4 +#endif + union A { - int f1: 3; + int f1 : 3 ALIGN4; A(); }; A::A() {} union B { - char f1: 35; + char f1 : 35 ALIGN4; B(); }; Index: clang/test/CodeGen/PR5060-align.c =================================================================== --- clang/test/CodeGen/PR5060-align.c +++ clang/test/CodeGen/PR5060-align.c @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -// CHECK: @foo.p = internal global i8 0, align 32 +// CHECK: @foo.p = internal global i8 0, align 16 char *foo(void) { - static char p __attribute__((aligned(32))); + static char p __attribute__((aligned(16))); return &p; } void bar(long n) { - // CHECK: align 32 - char p[n] __attribute__((aligned(32))); + // CHECK: align 16 + char p[n] __attribute__((aligned(16))); } Index: clang/test/AST/alignas_maybe_odr_cleanup.cpp =================================================================== --- clang/test/AST/alignas_maybe_odr_cleanup.cpp +++ clang/test/AST/alignas_maybe_odr_cleanup.cpp @@ -8,7 +8,7 @@ // RUN: | FileCheck %s struct FOO { - static const int vec_align_bytes = 32; + static const int vec_align_bytes = 16; void foo() { double a alignas(vec_align_bytes); ; @@ -17,7 +17,7 @@ // CHECK: | `-AlignedAttr {{.*}} <col:14> alignas // CHECK-NEXT: | `-ConstantExpr {{.*}} <col:22> 'int' -// CHECK-NEXT: | |-value: Int 32 +// CHECK-NEXT: | |-value: Int 16 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}} <col:22> 'int' <LValueToRValue> // CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:22> 'const int' lvalue Var {{.*}} 'vec_align_bytes' 'const int' non_odr_use_constant // CHECK-NEXT: `-NullStmt {{.*}} <line:14:5>
Index: clang/test/Layout/itanium-union-bitfield.cpp =================================================================== --- clang/test/Layout/itanium-union-bitfield.cpp +++ clang/test/Layout/itanium-union-bitfield.cpp @@ -1,15 +1,23 @@ // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s +// On z/OS, a bit-field has single byte alignment. Add aligned(4) on z/OS so the union has +// the same size & alignment as expected. +#ifdef __MVS__ +#define ALIGN4 __attribute__((aligned(4))) +#else +#define ALIGN4 +#endif + union A { - int f1: 3; + int f1 : 3 ALIGN4; A(); }; A::A() {} union B { - char f1: 35; + char f1 : 35 ALIGN4; B(); }; Index: clang/test/CodeGen/PR5060-align.c =================================================================== --- clang/test/CodeGen/PR5060-align.c +++ clang/test/CodeGen/PR5060-align.c @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -// CHECK: @foo.p = internal global i8 0, align 32 +// CHECK: @foo.p = internal global i8 0, align 16 char *foo(void) { - static char p __attribute__((aligned(32))); + static char p __attribute__((aligned(16))); return &p; } void bar(long n) { - // CHECK: align 32 - char p[n] __attribute__((aligned(32))); + // CHECK: align 16 + char p[n] __attribute__((aligned(16))); } Index: clang/test/AST/alignas_maybe_odr_cleanup.cpp =================================================================== --- clang/test/AST/alignas_maybe_odr_cleanup.cpp +++ clang/test/AST/alignas_maybe_odr_cleanup.cpp @@ -8,7 +8,7 @@ // RUN: | FileCheck %s struct FOO { - static const int vec_align_bytes = 32; + static const int vec_align_bytes = 16; void foo() { double a alignas(vec_align_bytes); ; @@ -17,7 +17,7 @@ // CHECK: | `-AlignedAttr {{.*}} <col:14> alignas // CHECK-NEXT: | `-ConstantExpr {{.*}} <col:22> 'int' -// CHECK-NEXT: | |-value: Int 32 +// CHECK-NEXT: | |-value: Int 16 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}} <col:22> 'int' <LValueToRValue> // CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:22> 'const int' lvalue Var {{.*}} 'vec_align_bytes' 'const int' non_odr_use_constant // CHECK-NEXT: `-NullStmt {{.*}} <line:14:5>
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits