[SystemZ] Add tests for ALHSIK and ALGHSIK

The insn definitions themselves crept into r186689, sorry.
This should be the last of the distinct-ops instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Sandiford 2013-07-19 16:44:32 +00:00
parent c7c7e1502a
commit 6dae7ae765
4 changed files with 147 additions and 0 deletions

View File

@ -20,3 +20,74 @@ define i64 @f1(i64 %a, i64 %b, i64 %c, i64 %d, i64 *%ptr) {
%low = extractelement <2 x i64> %addv, i32 1
ret i64 %low
}
; Test addition of 1.
define void @f2(i64 %a, i64 %b, i128 *%ptr) {
; CHECK-LABEL: f2:
; CHECK: alghsik {{%r[0-5]}}, %r3, 1
; CHECK: alcgr
; CHECK: br %r14
%x1 = insertelement <2 x i64> undef, i64 %a, i32 0
%x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
%x = bitcast <2 x i64> %x2 to i128
%add = add i128 %x, 1
store i128 %add, i128 *%ptr
ret void
}
; Test the upper end of the ALGHSIK range.
define void @f3(i64 %a, i64 %b, i128 *%ptr) {
; CHECK-LABEL: f3:
; CHECK: alghsik {{%r[0-5]}}, %r3, 32767
; CHECK: alcgr
; CHECK: br %r14
%x1 = insertelement <2 x i64> undef, i64 %a, i32 0
%x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
%x = bitcast <2 x i64> %x2 to i128
%add = add i128 %x, 32767
store i128 %add, i128 *%ptr
ret void
}
; Test the next value up, which should use ALGFI instead.
define void @f4(i64 %a, i64 %b, i128 *%ptr) {
; CHECK-LABEL: f4:
; CHECK: algfi %r3, 32768
; CHECK: alcgr
; CHECK: br %r14
%x1 = insertelement <2 x i64> undef, i64 %a, i32 0
%x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
%x = bitcast <2 x i64> %x2 to i128
%add = add i128 %x, 32768
store i128 %add, i128 *%ptr
ret void
}
; Test the lower end of the ALGHSIK range.
define void @f5(i64 %a, i64 %b, i128 *%ptr) {
; CHECK-LABEL: f5:
; CHECK: alghsik {{%r[0-5]}}, %r3, -32768
; CHECK: alcgr
; CHECK: br %r14
%x1 = insertelement <2 x i64> undef, i64 %a, i32 0
%x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
%x = bitcast <2 x i64> %x2 to i128
%add = add i128 %x, -32768
store i128 %add, i128 *%ptr
ret void
}
; Test the next value down, which cannot use either ALGHSIK or ALGFI.
define void @f6(i64 %a, i64 %b, i128 *%ptr) {
; CHECK-LABEL: f6:
; CHECK-NOT: alghsik
; CHECK-NOT: algfi
; CHECK: alcgr
; CHECK: br %r14
%x1 = insertelement <2 x i64> undef, i64 %a, i32 0
%x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
%x = bitcast <2 x i64> %x2 to i128
%add = add i128 %x, -32769
store i128 %add, i128 *%ptr
ret void
}

View File

@ -541,6 +541,36 @@
# CHECK: alg %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x0a
# CHECK: alghsik %r0, %r1, -32768
0xec 0x01 0x80 0x00 0x00 0xdb
# CHECK: alghsik %r2, %r3, -1
0xec 0x23 0xff 0xff 0x00 0xdb
# CHECK: alghsik %r4, %r5, 0
0xec 0x45 0x00 0x00 0x00 0xdb
# CHECK: alghsik %r6, %r7, 1
0xec 0x67 0x00 0x01 0x00 0xdb
# CHECK: alghsik %r8, %r15, 32767
0xec 0x8f 0x7f 0xff 0x00 0xdb
# CHECK: alhsik %r0, %r1, -32768
0xec 0x01 0x80 0x00 0x00 0xda
# CHECK: alhsik %r2, %r3, -1
0xec 0x23 0xff 0xff 0x00 0xda
# CHECK: alhsik %r4, %r5, 0
0xec 0x45 0x00 0x00 0x00 0xda
# CHECK: alhsik %r6, %r7, 1
0xec 0x67 0x00 0x01 0x00 0xda
# CHECK: alhsik %r8, %r15, 32767
0xec 0x8f 0x7f 0xff 0x00 0xda
# CHECK: alr %r0, %r0
0x1e 0x00

View File

@ -160,6 +160,16 @@
alfi %r0, -1
alfi %r0, (1 << 32)
#CHECK: error: {{(instruction requires: distinct-ops)?}}
#CHECK: alghsik %r1, %r2, 3
alghsik %r1, %r2, 3
#CHECK: error: {{(instruction requires: distinct-ops)?}}
#CHECK: alhsik %r1, %r2, 3
alhsik %r1, %r2, 3
#CHECK: error: invalid operand
#CHECK: alg %r0, -524289
#CHECK: error: invalid operand

View File

@ -49,6 +49,24 @@
ahik %r15, %r0, 0
ahik %r7, %r8, -16
#CHECK: alghsik %r0, %r0, -32768 # encoding: [0xec,0x00,0x80,0x00,0x00,0xdb]
#CHECK: alghsik %r0, %r0, -1 # encoding: [0xec,0x00,0xff,0xff,0x00,0xdb]
#CHECK: alghsik %r0, %r0, 0 # encoding: [0xec,0x00,0x00,0x00,0x00,0xdb]
#CHECK: alghsik %r0, %r0, 1 # encoding: [0xec,0x00,0x00,0x01,0x00,0xdb]
#CHECK: alghsik %r0, %r0, 32767 # encoding: [0xec,0x00,0x7f,0xff,0x00,0xdb]
#CHECK: alghsik %r0, %r15, 0 # encoding: [0xec,0x0f,0x00,0x00,0x00,0xdb]
#CHECK: alghsik %r15, %r0, 0 # encoding: [0xec,0xf0,0x00,0x00,0x00,0xdb]
#CHECK: alghsik %r7, %r8, -16 # encoding: [0xec,0x78,0xff,0xf0,0x00,0xdb]
alghsik %r0, %r0, -32768
alghsik %r0, %r0, -1
alghsik %r0, %r0, 0
alghsik %r0, %r0, 1
alghsik %r0, %r0, 32767
alghsik %r0, %r15, 0
alghsik %r15, %r0, 0
alghsik %r7, %r8, -16
#CHECK: algrk %r0, %r0, %r0 # encoding: [0xb9,0xea,0x00,0x00]
#CHECK: algrk %r0, %r0, %r15 # encoding: [0xb9,0xea,0xf0,0x00]
#CHECK: algrk %r0, %r15, %r0 # encoding: [0xb9,0xea,0x00,0x0f]
@ -61,6 +79,24 @@
algrk %r15,%r0,%r0
algrk %r7,%r8,%r9
#CHECK: alhsik %r0, %r0, -32768 # encoding: [0xec,0x00,0x80,0x00,0x00,0xda]
#CHECK: alhsik %r0, %r0, -1 # encoding: [0xec,0x00,0xff,0xff,0x00,0xda]
#CHECK: alhsik %r0, %r0, 0 # encoding: [0xec,0x00,0x00,0x00,0x00,0xda]
#CHECK: alhsik %r0, %r0, 1 # encoding: [0xec,0x00,0x00,0x01,0x00,0xda]
#CHECK: alhsik %r0, %r0, 32767 # encoding: [0xec,0x00,0x7f,0xff,0x00,0xda]
#CHECK: alhsik %r0, %r15, 0 # encoding: [0xec,0x0f,0x00,0x00,0x00,0xda]
#CHECK: alhsik %r15, %r0, 0 # encoding: [0xec,0xf0,0x00,0x00,0x00,0xda]
#CHECK: alhsik %r7, %r8, -16 # encoding: [0xec,0x78,0xff,0xf0,0x00,0xda]
alhsik %r0, %r0, -32768
alhsik %r0, %r0, -1
alhsik %r0, %r0, 0
alhsik %r0, %r0, 1
alhsik %r0, %r0, 32767
alhsik %r0, %r15, 0
alhsik %r15, %r0, 0
alhsik %r7, %r8, -16
#CHECK: alrk %r0, %r0, %r0 # encoding: [0xb9,0xfa,0x00,0x00]
#CHECK: alrk %r0, %r0, %r15 # encoding: [0xb9,0xfa,0xf0,0x00]
#CHECK: alrk %r0, %r15, %r0 # encoding: [0xb9,0xfa,0x00,0x0f]