This is an archive of the discontinued LLVM Phabricator instance.

Pre-commit test for D151696.
ClosedPublic

Authored by FreddyYe on Jun 14 2023, 7:46 PM.

Details

Summary

Meanwhile this patch added missing tests for supported CPU names
of cpu_dispatch/specific attribute and added more CHECKs for
resolver function.

Diff Detail

Event Timeline

FreddyYe created this revision.Jun 14 2023, 7:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2023, 7:46 PM
FreddyYe requested review of this revision.Jun 14 2023, 7:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2023, 7:46 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

As mentioned in https://reviews.llvm.org/D151696, ping here, too. I want to land this patch first so that I could add some new Intel CPUs in this test supported in https://reviews.llvm.org/D151696

FreddyYe updated this revision to Diff 534861.Jun 27 2023, 12:47 AM

Added more checks for resolver function.

FreddyYe edited the summary of this revision. (Show Details)Jun 27 2023, 6:02 PM

ping for review.

pengfei added inline comments.Jun 27 2023, 6:32 PM
clang/test/CodeGen/attr-cpuspecific-cpus.c
1–2

Is it only to check no compile warning/error? Should we add a -verify?

8

_MSC_VER or _WIN64?

FreddyYe updated this revision to Diff 535213.Jun 27 2023, 6:54 PM
FreddyYe marked an inline comment as done.

address comments.

FreddyYe added a comment.EditedJun 27 2023, 6:58 PM

It came to me a better style:

ATTR(cpu_specific(generic)) void CPU1(void){}
ATTR(cpu_specific(pentium_pro)) void CPU2(void){}
ATTR(cpu_specific(pentium_mmx)) void CPU3(void){}
ATTR(cpu_specific(pentium_ii)) void CPU4(void){}
ATTR(cpu_specific(pentium_iii)) void CPU5(void){}
ATTR(cpu_specific(pentium_iii_no_xmm_regs)) void CPU6(void){}
...

My purpose here is only to check if the cpu name string is valid for cpu_specific. So this also looks good, though it doesn't do the multiversion. I'll change into this style if no objections.

clang/test/CodeGen/attr-cpuspecific-cpus.c
1–2

Yes, that's my purpose. Will do.

8

Good catch.

FreddyYe updated this revision to Diff 535215.Jun 27 2023, 7:08 PM

Change into a more simplified style.

pengfei accepted this revision.Jun 27 2023, 7:19 PM

LGTM.

This revision is now accepted and ready to land.Jun 27 2023, 7:19 PM
skan added inline comments.Jun 27 2023, 7:46 PM
clang/test/CodeGen/attr-cpuspecific-cpus.c
13

Shouldn't we use the same function name?

FreddyYe added inline comments.Jun 27 2023, 8:00 PM
clang/test/CodeGen/attr-cpuspecific-cpus.c
13

Emmm... it would involve a new problem that some aliased cpu names would result a diagnostic like this:

definition with same mangled name 'CPU.H' as another definition

This is expected but my original purpose here is only to check if cpu name strings are valid. If you prefer, I can change into a style that makes the non-alias CPU names use the same function and makes the aliased ones' function names indexed. WDYT?

skan added inline comments.Jun 27 2023, 8:02 PM
clang/test/CodeGen/attr-cpuspecific-cpus.c
13

That would make sense to me.

FreddyYe updated this revision to Diff 535223.Jun 27 2023, 8:34 PM

Seperate ALIAS CPUs.

skan accepted this revision.Jun 27 2023, 8:37 PM

LGTM

This revision was landed with ongoing or failed builds.Jun 27 2023, 10:53 PM
This revision was automatically updated to reflect the committed changes.