These instructions have a fixed register constraint; the shift amount is passed in CL. Add meta language syntax so a fixed register can be specified as "GPR.rcx".
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
; binary emission of 32-bit code.
|
|
test binemit
|
|
isa intel
|
|
|
|
; The binary encodings can be verified with the command:
|
|
;
|
|
; sed -ne 's/^ *; asm: *//p' filetests/isa/intel/binary32.cton | llvm-mc -show-encoding -triple=i386
|
|
;
|
|
|
|
function I32() {
|
|
ebb0:
|
|
[-,%rcx] v1 = iconst.i32 1
|
|
[-,%rsi] v2 = iconst.i32 2
|
|
|
|
; Integer Register-Register Operations.
|
|
|
|
; asm: addl %esi, %ecx
|
|
[-,%rcx] v10 = iadd v1, v2 ; bin: 01 f1
|
|
; asm: addl %ecx, %esi
|
|
[-,%rsi] v11 = iadd v2, v1 ; bin: 01 ce
|
|
|
|
; Dynamic shifts take the shift amount in %rcx.
|
|
|
|
; asm: shll %cl, %esi
|
|
[-,%rsi] v12 = ishl v2, v1 ; bin: d3 e6
|
|
; asm: shll %cl, %ecx
|
|
[-,%rcx] v13 = ishl v1, v1 ; bin: d3 e1
|
|
; asm: shrl %cl, %esi
|
|
[-,%rsi] v14 = ushr v2, v1 ; bin: d3 ee
|
|
; asm: shrl %cl, %ecx
|
|
[-,%rcx] v15 = ushr v1, v1 ; bin: d3 e9
|
|
; asm: sarl %cl, %esi
|
|
[-,%rsi] v16 = sshr v2, v1 ; bin: d3 fe
|
|
; asm: sarl %cl, %ecx
|
|
[-,%rcx] v17 = sshr v1, v1 ; bin: d3 f9
|
|
|
|
return
|
|
}
|