[PATCH] D21809: [SystemZ] Add support for .insn and .word/.short/.long/.quad directives

Zhan Jun Liau via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 14:27:44 PDT 2016


zhanjunl added a comment.

>From my understanding, gas only supports some of the possible s390 instruction formats when using ".insn". For example, the "ri" format in the insn directive corresponds to the RI-a format, which uses an immediate field and not a relative-immediate field. Therefore, for the .insn directive specifically:

ri = RI-a
rie = RIE-d
ril = RIL-a

I tried assembling a sample .insn directive with gas:

          .text
          .globl  main
          .type   main, at function
  main:
          lghi    %r2, 0
  #       brct %r2,.label
          .insn ri,0xa7060000,%r2,.label
  .label:
          br      %r14
  .Lfunc_end0:
          .size   main, .Lfunc_end0-main

gas will assemble the above code with no errors, but when I do an objdump of the object file, I see:

  temp.o:     file format elf64-s390
  
  
  Disassembly of section .text:
  
  0000000000000000 <main>:
     0:   a7 29 00 00             lghi    %r2,0
     4:   a7 26 00 00             brct    %r2,4 <main+0x4>
  
  0000000000000008 <.label>:
     8:   07 fe                   br      %r14
     a:   07 07                   nopr    %r7

So it looks like it was able to get the correct instruction mnemonic, but it silently fails when trying to encode the label into the instruction. This was my understanding when supporting the .insn, and so I didn't expect to have to do any fixups. Unless I'm mistaken?


http://reviews.llvm.org/D21809





More information about the llvm-commits mailing list