Page MenuHomePhabricator

[LoongArch] Add custom parser for atomic instructions' memory operand
ClosedPublic

Authored by wangleiat on Dec 5 2022, 2:01 AM.

Details

Summary

In order to be compatible with the form of the atomic instruction in
GAS that accepts the fourth operand as 0 (i.e. am* $rd, $rk, $rj, 0),
we need to treat $rj, 0 as one operand, but only print $rj.

For this, the number of result operands of inline assembly memory
operand ZB constraint is modified to 2 (reg + 0).

Restrictions on register usage in am* instructions have also been
adjusted. When $rd is equal to $r0, the instruction must be
considered legal, because of some special usage like PseudoUNIMP.

Diff Detail

Unit TestsFailed

TimeTest
60,070 msx64 debian > libFuzzer.libFuzzer::fuzzer-leak.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LeakTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-leak.test.tmp-LeakTest
60,040 msx64 debian > libFuzzer.libFuzzer::minimize_crash.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/NullDerefTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/minimize_crash.test.tmp-NullDerefTest
60,040 msx64 debian > libFuzzer.libFuzzer::value-profile-load.test
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LoadTest.cpp -fsanitize-coverage=trace-gep -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-load.test.tmp-LoadTest

Event Timeline

wangleiat created this revision.Dec 5 2022, 2:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 2:01 AM
wangleiat requested review of this revision.Dec 5 2022, 2:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 2:01 AM
SixWeining accepted this revision.Dec 7 2022, 2:00 AM

LGTM but let's wait for others.

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.cpp
64

Seems this line is useless.

This revision is now accepted and ready to land.Dec 7 2022, 2:00 AM
xen0n accepted this revision.Dec 7 2022, 10:39 PM
xen0n edited the summary of this revision. (Show Details)

LGTM, thanks!

I've fixed the formatting of the summary for you (the ordered lists can't be used to write Chinese-style paragraphs) while at it.

LGTM, thanks!

I've fixed the formatting of the summary for you (the ordered lists can't be used to write Chinese-style paragraphs) while at it.

Thank you very much!

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.cpp
64

Thanks, i'll remove it.

wangleiat updated this revision to Diff 481202.Dec 8 2022, 1:56 AM

Address @SixWeining's comment.

This revision was landed with ongoing or failed builds.Dec 12 2022, 7:47 PM
This revision was automatically updated to reflect the committed changes.