This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Fix the check for scalar MASS conversion
ClosedPublic

Authored by masoud.ataei on Jun 27 2022, 8:18 AM.

Details

Summary

Proposing to move the check for scalar MASS conversion from constructor
of PPCTargetLowering to the lowerLibCallBase function which decides
about the lowering.

The Target machine option Options.PPCGenScalarMASSEntries is set in
PPCTargetMachine.cpp. But an object of the class PPCTargetLowering
is created in one of the included header files. So, the constructor will run
before setting PPCGenScalarMASSEntries to correct value. So, we cannot
check this option in the constructor.

Diff Detail

Event Timeline

masoud.ataei created this revision.Jun 27 2022, 8:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2022, 8:18 AM
masoud.ataei requested review of this revision.Jun 27 2022, 8:18 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 27 2022, 8:18 AM

The description should explain why this change is necessary.

clang/test/CodeGen/lower-mass-end-to-end.c
2

Please add negative end-to-end tests as well (eg. when -enable-ppc-gen-scalar-mass is false or when -fno-approx-func).

Add more tests.

masoud.ataei marked an inline comment as done.Jun 27 2022, 11:31 AM
masoud.ataei edited the summary of this revision. (Show Details)Jun 27 2022, 11:41 AM
bmahjour added inline comments.Jun 27 2022, 2:17 PM
clang/test/CodeGen/lower-mass-end-to-end.c
34–35

Please also check for

CHECK-NOMASS-FAST-NOT: xl_sin
CHECK-NOMASS-AFN-NOT:
xl_sin_finit

and do the same for other tests.

Test updated.

masoud.ataei marked an inline comment as done.Jun 28 2022, 7:48 AM
bmahjour added inline comments.Jun 28 2022, 2:46 PM
clang/test/CodeGen/lower-mass-end-to-end.c
34

I don't think this works the way you expect it:

> cat input.txt
; CHECK-NOT: __xl_sin{{_finite}}
> echo "__xl_sin" | ./bin/FileCheck ./input.txt
>

this seems closer to what you want:

; CHECK-NOT: {{__xl_sin|__xl_sin_finite}}

Update the test

bmahjour accepted this revision.Jun 29 2022, 2:40 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Jun 29 2022, 2:40 PM
masoud.ataei closed this revision.Jul 6 2022, 11:45 AM
dyung added a subscriber: dyung.Jul 6 2022, 12:36 PM

Hi @masoud.ataei, the test you added in this commit is failing on the PS4 bot, can you take a look?

https://lab.llvm.org/buildbot/#/builders/139/builds/24469

clang (LLVM option parsing): Unknown command line argument '-enable-ppc-gen-scalar-mass'.  Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '--enable-x86-scalar-amx'?

Just took it down temporarily. -- Looking at it...

lenary added a subscriber: lenary.Jul 6 2022, 12:55 PM

You likely need // REQUIRES: powerpc-registered-target in the top of the test, as -enable-ppc-gen-scalar-mass is only present if the PowerPC target has been compiled into LLVM.

You likely need // REQUIRES: powerpc-registered-target in the top of the test, as -enable-ppc-gen-scalar-mass is only present if the PowerPC target has been compiled into LLVM.

Thanks, I was looking for that. -- re-committing...