[Llvm-bgq-discuss] Interpreting CLANG assembly

Hal Finkel hfinkel at anl.gov
Thu Apr 18 15:45:45 CDT 2013


----- Original Message -----
> From: "Thomas Gooding" <tgooding at us.ibm.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Ian Karlin" <karlin1 at llnl.gov>, llvm-bgq-discuss at lists.alcf.anl.gov
> Sent: Thursday, April 18, 2013 3:38:28 PM
> Subject: Re: [Llvm-bgq-discuss] Interpreting CLANG assembly
> 
> 
> 
> Hal Finkel <hfinkel at anl.gov> wrote on 04/18/2013 03:08:24 PM:
> > > From: "Thomas Gooding" <tgooding at us.ibm.com>
> > > I'm not sure it uses the same assembler as gcc. The following is
> > > an
> > > instruction that gave me some trouble, it assembles under gcc but
> > > not llvm.
> > > mtfsf 0,%f0,1,0
> > > 
> > > start.S: Assembler messages:
> > > start.S:278: Error: junk at end of line: `1,0'
> > > 
> > > The mtfsf instruction appears to have additional parameters in
> > > the
> > > embedded PowerPC book.
> > 
> > That's odd; can you grep both assembly files so that I can see that
> > LLVM prints vs. what gcc prints?
> 
> llvm:
> $LLVMHOME/bgclang -m64 -g -O2 -Werror -MMD -MF .dep.start.S.d
> -D__KERNEL__ -Wall -I/bghome/tgooding/bgq/work -iquote
> /bghome/tgooding/bgq/cnk/src
> -I/bghome/tgooding/bgq/work/spi/include/kernel/firmware
> -fno-strict-aliasing -c -D__ASSEMBLY__ -S -Os start.S
> ...
> lfd %f0,1280(%r3)
> mtfsf 0,%f0,1,0
> qvlfdux %f0,%r11,%r0
> qvlfdux %f1,%r11,%r0
> qvlfdux %f2,%r11,%r0
> ...
> 
> gcc:
> /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gcc -m64 -g
> -O2 -Werror -MMD -MF .dep.start.S.d -D__KERNEL__ -Wall
> -I/bghome/tgooding/bgq/work -iquote /bghome/tgooding/bgq/cnk/src
> -I/bghome/tgooding/bgq/work/spi/include/kernel/firmware
> -fno-strict-aliasing -c -D__ASSEMBLY__ -S -Os start.S
> ...
> lfd %f0,1280(%r3)
> mtfsf 0,%f0,1,0
> qvlfdux %f0,%r11,%r0
> qvlfdux %f1,%r11,%r0
> qvlfdux %f2,%r11,%r0
> ...
> 
> After increasing the verbosity (bgclang -v), the assembler call looks
> incorrect:
> "/bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/bin/as"
> -a64 -mppc64 -many -o start.o /tmp/start-9mU46t.s
> 
> Whereas I think it should be:
> "/bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/bin/as"
> -a64 -ma2q -many -o start.o /tmp/start-9mU46t.s
> 
> Maybe there's a way to configure this somewhere?

I'll need to update it in the driver; thanks for investigating this! The problem is that Clang tries to cheat, in a sense, and instead of trying to figure out exactly which architecture to use for different ppc64 cores, it just passes -many (which should enable all extensions). However, this may fall down where embedded extensions are involved. If you take the assembly file and compile it with the default as command line, but add -mbooke, does that make it work?

 -Hal

> 
> Thanks,
> Tom
> 
> > Thanks again,
> > Hal
> 
> Tom Gooding
> Senior Engineer / Blue Gene Kernels
> 507-253-0747 (internal: 553-0747)
> 


More information about the llvm-bgq-discuss mailing list