[llvm-bugs] [Bug 31541] New: clang 3.9.1 targeting powerpc rejects "cmp 0, %r1, %r3" in a .S file for "too few operands for instruction" (FreeBSD buildkernel context)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 4 19:12:27 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31541
Bug ID: 31541
Summary: clang 3.9.1 targeting powerpc rejects "cmp 0, %r1,
%r3" in a .S file for "too few operands for
instruction" (FreeBSD buildkernel context)
Product: libraries
Version: 3.9
Hardware: Macintosh
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: Backend: PowerPC
Assignee: unassignedbugs at nondot.org
Reporter: markmi at dsl-only.net
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
[lib/Target/PowerPC is a guess on my part for where the
issue would be addressed.]
In attempting to buildkernel via FreeBSD's clang 3.9.1 variant
the attempt stops with the following for code that has been in
place in FreeBSD for a very long time (historically gcc 4.2.1
toolchain use):
--- locore.o ---
/usr/src/sys/powerpc/aim/trap_subr32.S:409:2: error: too few operands for
instruction
cmp 0, %r1, %r3
^
*** [locore.o] Error code 1
make[2]: stopped in
/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG
.ERROR_TARGET='locore.o'
.ERROR_META_FILE='/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/locore.o.meta'
# Meta data file
/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/locore.o.meta
CMD cc -target powerpc-unknown-freebsd12.0
--sysroot=/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/tmp
-B/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/tmp/usr/bin -c -x
assembler-with-cpp -DLOCORE -O -pipe -g -nostdinc -I. -I/usr/src/sys
-I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include
opt_global.h -msoft-float -fPIC -fno-omit-frame-pointer -mno-altivec
-ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
-Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -Wno-error-unused-function
-Wno-error-pointer-sign -Wno-error-shift-negative-value -msoft-float
-std=iso9899:1999 -Werror /usr/src/sys/powerpc/aim/locore.S
CWD
/usr/obj/powerpcvtsc_clang_kernel/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG
TARGET locore.o
-- command output --
/usr/src/sys/powerpc/aim/trap_subr32.S:409:2: error: too few operands for
instruction
cmp 0, %r1, %r3
^
*** Error code 1
clang 3.9.1 is not allowing the optional crD to be optional
in the instruction format:
cmp [crD,]L,rA,rB
The following:
# svnlite diff /usr/src/sys/powerpc/aim/trap_subr32.S
Index: /usr/src/sys/powerpc/aim/trap_subr32.S
===================================================================
--- /usr/src/sys/powerpc/aim/trap_subr32.S (revision 311147)
+++ /usr/src/sys/powerpc/aim/trap_subr32.S (working copy)
@@ -406,7 +406,7 @@
mtctr %r1 /* load counter */
im1:
lwzu %r1, 8(%r2) /* get next pte */
- cmp 0, %r1, %r3 /* see if found pte */
+ cmp 0, 0, %r1, %r3 /* see if found pte */
bdnzf 2, im1 /* dec count br if cmp ne and if
* count not zero */
bne instr_sec_hash /* if not found set up second hash
allows buildkernel to progress past this.
(The above filled in the default value explicltly.)
[So FreeBSD can avoid the specific issue. This issue is unlikely
to be considered an issue that contributes to why the system
compiler for powerpc can not be clang yet.]
Materials around such as:
http://www.tentech.ca/downloads/other/PPC_Quick_Ref_Card-Rev1_Oct12_2010.pdf
show the optional status for crD. My guess is that the clang toolchain is
incomplete in its coverage for the intended notation.
(I've no clue if there are other such optional-syntax issues in general.
If there are then FreeBSD does not seem to have examples of hitting any
of the other examples via its clang 3.9.1 variant.)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170105/59ea1c31/attachment.html>
More information about the llvm-bugs
mailing list