• Michael Munday's avatar
    cmd/asm: add 'insert program mask' instruction for s390x · 6966b675
    Michael Munday authored
    This CL adds the 'insert program mask' (IPM) instruction to s390x.
    IPM stores the current program mask (which contains the condition
    code) into a general purpose register.
    
    This instruction will be useful when implementing intrinsics for
    the arithmetic functions in the math/bits package. We can also
    potentially use it to convert some condition codes into bool
    values.
    
    The condition code can be saved and restored using an instruction
    sequence such as:
    
      IPM  R4          // save condition code to R4
      ...
      TMLH R4, $0x3000 // restore condition code from R4
    
    We can also use IPM to save the carry bit to a register using an
    instruction sequence such as:
    
      IPM     R4                   // save condition code to R4
      RISBLGZ $31, $31, $3, R4, R4 // isolate carry bit in R4
    
    Change-Id: I169d450b6ea1a7ff8c0286115ddc42618da8a2f4
    Reviewed-on: https://go-review.googlesource.com/c/go/+/165997
    Run-TryBot: Michael Munday <mike.munday@ibm.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    6966b675
a.out.go 12 KB