This is an archive of the discontinued LLVM Phabricator instance.

Ensure -mcpu=xscale works for arm targets
ClosedPublic

Authored by dim on Jan 10 2016, 11:58 PM.

Details

Summary

At some point between 3.7.1 and 3.8.0 (current trunk), for arm targets,
the -mcpu option got broken, in the sense that it no longer accepts
-mcpu=xscale as an option.

I am unsure what the exact cause is, but it looks like adding "v5e" as a
SUB_ARCH in ARMTargetParser.def helps. This was submitted by @andrew.

Diff Detail

Repository
rL LLVM

Event Timeline

dim updated this revision to Diff 44433.Jan 10 2016, 11:58 PM
dim retitled this revision from to Ensure -mcpu=xscale works for arm targets.
dim updated this object.
dim added reviewers: rengolin, t.p.northover.
dim added subscribers: andrew, llvm-commits.
rengolin edited edge metadata.Jan 11 2016, 7:54 AM

Sorry, can you describe the problem and how does this fix?

This seems like a Clang bug too (not parsing the correct cpu flag?), so a test in Clang would also be necessary to show that it's now passing.

cheers,
--renato

dim added a comment.Jan 11 2016, 8:06 AM

Sorry, can you describe the problem and how does this fix?

I think this is fallout from either D14577 or D14578. The problem is that with -target arm-freebsd (or arm-linux, for that matter), the -mcpu=xscale option is no longer accepted. E.g. with clang 3.7.1:

$ ~/obj/llvm-255217M-fin371-freebsd11-i386-aconf-rel-1/Release+Asserts/bin/clang -target arm-freebsd -mcpu=xscale -c -x c /dev/null -###
clang version 3.7.1 (tags/RELEASE_371/final 255217)
Target: arm--freebsd
Thread model: posix
 "/home/dim/obj/llvm-255217M-fin371-freebsd11-i386-aconf-rel-1/Release+Asserts/bin/clang" "-cc1" "-triple" "armv5e--freebsd" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "null" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "xscale" "-target-feature" "+soft-float" "-target-feature" "+soft-float-abi" "-target-feature" "-neon" "-target-feature" "-crypto" "-target-abi" "aapcs" "-msoft-float" "-mfloat-abi" "soft" "-target-linker-version" "2.25.1" "-dwarf-column-info" "-coverage-file" "/home/dim/null" "-resource-dir" "/home/dim/obj/llvm-255217M-fin371-freebsd11-i386-aconf-rel-1/Release+Asserts/bin/../lib/clang/3.7.1" "-fdebug-compilation-dir" "/home/dim" "-ferror-limit" "19" "-fmessage-length" "114" "-mstackrealign" "-fno-signed-char" "-fobjc-runtime=gnustep" "-fsjlj-exceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "null.o" "-x" "c" "/dev/null"

and with clang 3.8.0:

$ ~/obj/llvm-256945-trunk-freebsd11-i386-ninja-rel-1/bin/clang -target arm-freebsd -mcpu=xscale -c -x c /dev/null -###
clang version 3.8.0 (trunk 256945)
Target: arm--freebsd
Thread model: posix
InstalledDir: /home/dim/obj/llvm-256945-trunk-freebsd11-i386-ninja-rel-1/bin
clang-3.8: error: the clang compiler does not support '-mcpu=xscale'
 "/home/dim/obj/llvm-256945-trunk-freebsd11-i386-ninja-rel-1/bin/clang-3.8" "-cc1" "-triple" "arm--freebsd" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "null" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "xscale" "-target-feature" "+soft-float" "-target-feature" "+soft-float-abi" "-target-feature" "-neon" "-target-feature" "-crypto" "-target-feature" "+strict-align" "-target-abi" "aapcs" "-msoft-float" "-mfloat-abi" "soft" "-dwarf-column-info" "-debugger-tuning=gdb" "-coverage-file" "/home/dim/null" "-resource-dir" "/home/dim/obj/llvm-256945-trunk-freebsd11-i386-ninja-rel-1/bin/../lib/clang/3.8.0" "-fdebug-compilation-dir" "/home/dim" "-ferror-limit" "19" "-fmessage-length" "114" "-fallow-half-arguments-and-returns" "-fno-signed-char" "-fobjc-runtime=gnustep" "-fsjlj-exceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "null.o" "-x" "c" "/dev/null"

This seems like a Clang bug too (not parsing the correct cpu flag?), so a test in Clang would also be necessary to show that it's now passing.

Yes, I'll add a test. The problem is that clang still returns 0 in the second case above, so it'll have to be tested by grepping for the the clang compiler does not support output line...

rengolin accepted this revision.Jan 11 2016, 8:11 AM
rengolin edited edge metadata.

Right, when you said "no longer accepted" I thought you got an error message.

In this case, the change is correct and LGTM.

Please commit a separate test for clang checking for the right triple.

Thanks!

This revision is now accepted and ready to land.Jan 11 2016, 8:11 AM
dim added a comment.Jan 11 2016, 8:14 AM

Right, when you said "no longer accepted" I thought you got an error message.

Well, there *is* an error message "clang-3.8: error: the clang compiler does not support '-mcpu=xscale'" :-)

In this case, the change is correct and LGTM.

Please commit a separate test for clang checking for the right triple.

Sure, thanks.

This revision was automatically updated to reflect the committed changes.
dim added a comment.Jan 12 2016, 2:59 PM

Test for clang added in rL257509.