This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by lkail on Mar 10 2022, 9:34 PM.

Details

Summary

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.

Diff Detail

Event Timeline

lkail created this revision.Mar 10 2022, 9:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 9:34 PM
lkail requested review of this revision.Mar 10 2022, 9:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 9:34 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
lkail updated this revision to Diff 414574.Mar 10 2022, 9:48 PM
lkail updated this revision to Diff 414575.
lkail updated this revision to Diff 414583.Mar 10 2022, 10:40 PM

Add -verify.

jsji accepted this revision as: jsji.Mar 15 2022, 1:41 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Mar 15 2022, 1:41 PM
clang/test/CodeGen/PowerPC/atomic-alignment.c
3–7

Fix typos: "unkonwn"

clang/test/CodeGen/PowerPC/atomic-alignment.c
2

I am not sure about having a CodeGen test for this when a -fsyntax-only Layout test would do. I believe that also removes the need for powerpc-registered-target.

clang/test/Sema/atomic-ops.c
7–8

Consider testing across the -mcpu=power7 and -mcpu=power8 boundary.

lkail updated this revision to Diff 415684.Mar 15 2022, 8:34 PM

Fix typo; Add pwr7 and pwr8 as -target-cpu.

LGTM with comment (not blocking).

clang/test/CodeGen/PowerPC/atomic-alignment.c
2

I will note that there is a concept of "preferred alignment" or "complete object alignment" that may differ from "required alignment". A CodeGen test like this can miss issues if the "required alignment" is wrong but the "preferred alignment" or "complete object alignment" matches what is expected.

lkail added inline comments.Mar 17 2022, 10:21 PM
clang/test/CodeGen/PowerPC/atomic-alignment.c
2

That's a good point. However currently, I haven't found any tests in test/Sema performing such check and I have't figure out a way to add such check. Maybe checking __alignof__() % (expected_align) == 0 is more practical.

This revision was landed with ongoing or failed builds.Mar 17 2022, 10:22 PM
This revision was automatically updated to reflect the committed changes.
clang/test/CodeGen/PowerPC/atomic-alignment.c
2

There are tests in test/Layout that might be closer.