What assembler are people using with the SystemZ backend? I am trying to assemble the output of the SystemZ backend with the GNU binutils assembler (build with --target=s390x-linux). I get errors when assembling instructions with literals that are negatives. For example, the test case test/CodeGen/SystemZ/01-RetImm.ll gives errors: $ s390x-as 01-RetImm.s 01-RetImm.s: Assembler messages: 01-RetImm.s:16: Error: operand out of range (0xffffffffffffffff is not between 0x0000000000000000 and 0x000000000000ffff) 01-RetImm.s:61: Error: operand out of range (0xffffffffffffffff is not between 0x0000000000000000 and 0x00000000ffffffff) line 16 is: llill %r2, -1 <<< why -1 which was generated from: define i64 @foo2() { entry: ret i64 65535 } Why are negative literals being generated. regards, bagel
Anton Korobeynikov
2011-Jan-30 18:44 UTC
[LLVMdev] question on assembler for systemz backend
Hello> I am trying to assemble the output of the SystemZ backend with the GNU > binutils assembler (build with --target=s390x-linux). I get errors when > assembling instructions with literals that are negatives. For example, > the test case test/CodeGen/SystemZ/01-RetImm.ll gives errors:There are different instruction sets for z/System. Basically, you have to provide proper -march / -mcpu to assembler, otherwise the very old ISA is assumed. I don't recall offhand, but you need to provide either z990 or z9-109, because LLVM assumes that long displacements and ext imm stuff is available (this is rather fair assumption).> llill %r2, -1 <<< why -1Because it sets lowest (ll) 16 bit word of 64 bits.> Why are negative literals being generated.Because of z/Systems ISA :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Hi Anton, On 01/30/2011 12:44 PM, Anton Korobeynikov wrote:> Hello > >> I am trying to assemble the output of the SystemZ backend with the GNU >> binutils assembler (build with --target=s390x-linux). I get errors when >> assembling instructions with literals that are negatives. For example, >> the test case test/CodeGen/SystemZ/01-RetImm.ll gives errors: > There are different instruction sets for z/System. Basically, you have > to provide proper -march / -mcpu to assembler, otherwise the very old > ISA is assumed. > I don't recall offhand, but you need to provide either z990 or z9-109, > because LLVM assumes that long displacements and ext imm stuff is > available (this is rather fair assumption). >I have tried: s390x-as -m64 -march=z900 s390x-as -m64 -march=z990 s390x-as -m64 -march=z9-109 All give the same error messages. This is with binutils-2.20.51.>> llill %r2, -1<<< why -1 > Because it sets lowest (ll) 16 bit word of 64 bits.The way I read the gas code for s390, "llill" expects the second operand to be unsigned, and the parsed expression is cast to unsigned before the range check. This does not appear to be -march dependent.> >> Why are negative literals being generated. > Because of z/Systems ISA :) >I'd still like to know if anyone has sucessfully assembled SystemZ generated assembly language with a binutils assembler, and if so, how. regards, bagel
Seemingly Similar Threads
- [LLVMdev] question on assembler for systemz backend
- [LLVMdev] question on assembler for systemz backend
- [LLVMdev] [RFC/PATCH][0/4] New SystemZ backend
- [LLVMdev] [RFC/PATCH][0/4] New SystemZ backend
- [LLVMdev] [RFC/PATCH][1/4] New SystemZ backend: LLVM code changes