Problem with SuperH inline assembly

N. Coesel nico at nctdev.nl
Wed May 27 20:04:16 UTC 2009


I'm evaluating the SuperH package and I ran into a problem when using
inline assembly.

I'm trying to compile the attached test.c (a small dummy program to
reproduce the problem) but I get the an unknown opcode error on the inline
assembly. I tried changing the isa and architecture but this has no effect.

C:\software\H8 gcc>sh-linux-gnu-gcc -Wa,-ahld -m2 test.c >test.lst
C:\DOCUME~1\nctnico\LOCALS~1\Temp\ccohSo3P.s: Assembler messages:
C:\DOCUME~1\nctnico\LOCALS~1\Temp\ccohSo3P.s:14: Error: unknown opcode
C:\DOCUME~1\nctnico\LOCALS~1\Temp\ccohSo3P.s:17: Error: unknown opcode

I also attached the assembler listing. I also have some assembler files
which have been assembled using an older version of as. These won't
assemble either. The .h8300s directive as described in the manual is also
not recognized. I guess the assembler is not complete.

Nico Coesel
-------------- next part --------------
//#include <stdlib>
//#include <stdio>


unsigned char
get_ccr() {
/*
 * haal het ccr irq bit op 
 */
   unsigned char temp;
asm("	sub.l	r0,r0 ");
asm("	stc.b	ccr,r0l ");

   return temp;
}


int main()
{
unsigned char a=0;
a=get_ccr();

return a;
}
-------------- next part --------------
Renesas / SuperH SH GAS Little Endian C:\DOCUME~1\nctnico\LOCALS~1\Temp\ccohSo3P.s 			page 1


   1              		.file	"test.c"
   2              		.text
   3              		.little
   4              		.text
   5              		.align 1
   6              		.global	get_ccr
   8              	get_ccr:
   9 ???? E62F     		mov.l	r14, at -r15
  10 ???? 007F     		add	#-4,r15
  11 ???? F36E     		mov	r15,r14
  12              	#APP
  13              	! 11 "test.c" 1
  14              			sub.l	r0,r0 
  15              	! 0 "" 2
  16              	! 12 "test.c" 1
  17              			stc.b	ccr,r0l 
  18              	! 0 "" 2
  19              	#NO_APP
  20 ???? E361     		mov	r14,r1
  21 ???? 0071     		add	#3,r1
  22 ???? 1061     		mov.b	@r1,r1
  23 ???? 1C61     		extu.b	r1,r1
  24 ???? 1360     		mov	r1,r0
  25 ???? 007E     		add	#4,r14
  26 ???? E36F     		mov	r14,r15
  27 ???? F66E     		mov.l	@r15+,r14
  28 ???? 0B00     		rts	
  29 ???? 0900     		nop
  31              		.align 1
  32              		.global	main
  34              	main:
  35 ???? E62F     		mov.l	r14, at -r15
  36 ???? 224F     		sts.l	pr, at -r15
  37 ???? 007F     		add	#-4,r15
  38 ???? F36E     		mov	r15,r14
  39 ???? E362     		mov	r14,r2
  40 ???? 0072     		add	#3,r2
  41 ???? 00E1     		mov	#0,r1
  42 ???? 1022     		mov.b	r1, at r2
  43 ???? 00D1     		mov.l	.L5,r1
  44 ???? 0B41     		jsr	@r1
  45 ???? 0900     		nop
  46 ???? 0361     		mov	r0,r1
  47 ???? 1362     		mov	r1,r2
  48 ???? E361     		mov	r14,r1
  49 ???? 0071     		add	#3,r1
  50 ???? 2021     		mov.b	r2, at r1
  51 ???? E361     		mov	r14,r1
  52 ???? 0071     		add	#3,r1
  53 ???? 1061     		mov.b	@r1,r1
  54 ???? 1C61     		extu.b	r1,r1
  55 ???? 1360     		mov	r1,r0
  56 ???? 007E     		add	#4,r14
  57 ???? E36F     		mov	r14,r15
  58 ???? 264F     		lds.l	@r15+,pr
  59 ???? F66E     		mov.l	@r15+,r14
  60 ???? 0B00     		rts	
Renesas / SuperH SH GAS Little Endian C:\DOCUME~1\nctnico\LOCALS~1\Temp\ccohSo3P.s 			page 2


  61 ???? 0900     		nop
  62              	.L6:
  63              		.align 2
  64              	.L5:
  65 ???? 00000000 		.long	get_ccr
  67              		.ident	"GCC: (Sourcery G++ Lite 4.3-143) 4.3.3"
  68              		.section	.note.GNU-stack,"", at progbits


More information about the superh-gnu-discuss mailing list