1 ; Test 32-bit addition in which the second operand is constant and in which 2 ; three-operand forms are available. 3 ; 4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s 5 6 ; Check additions of 1. 7 define i32 @f1(i32 %a, i32 %b) { 8 ; CHECK-LABEL: f1: 9 ; CHECK: ahik %r2, %r3, 1 10 ; CHECK: br %r14 11 %add = add i32 %b, 1 12 ret i32 %add 13 } 14 15 ; Check the high end of the AHIK range. 16 define i32 @f2(i32 %a, i32 %b) { 17 ; CHECK-LABEL: f2: 18 ; CHECK: ahik %r2, %r3, 32767 19 ; CHECK: br %r14 20 %add = add i32 %b, 32767 21 ret i32 %add 22 } 23 24 ; Check the next value up, which must use AFI instead. 25 define i32 @f3(i32 %a, i32 %b) { 26 ; CHECK-LABEL: f3: 27 ; CHECK: afi {{%r[0-5]}}, 32768 28 ; CHECK: br %r14 29 %add = add i32 %b, 32768 30 ret i32 %add 31 } 32 33 ; Check the high end of the negative AHIK range. 34 define i32 @f4(i32 %a, i32 %b) { 35 ; CHECK-LABEL: f4: 36 ; CHECK: ahik %r2, %r3, -1 37 ; CHECK: br %r14 38 %add = add i32 %b, -1 39 ret i32 %add 40 } 41 42 ; Check the low end of the AHIK range. 43 define i32 @f5(i32 %a, i32 %b) { 44 ; CHECK-LABEL: f5: 45 ; CHECK: ahik %r2, %r3, -32768 46 ; CHECK: br %r14 47 %add = add i32 %b, -32768 48 ret i32 %add 49 } 50 51 ; Check the next value down, which must use AFI instead. 52 define i32 @f6(i32 %a, i32 %b) { 53 ; CHECK-LABEL: f6: 54 ; CHECK: afi {{%r[0-5]}}, -32769 55 ; CHECK: br %r14 56 %add = add i32 %b, -32769 57 ret i32 %add 58 } 59 60 ; Check that AHI is still used in obvious cases. 61 define i32 @f7(i32 %a) { 62 ; CHECK-LABEL: f7: 63 ; CHECK: ahi %r2, 1 64 ; CHECK: br %r14 65 %add = add i32 %a, 1 66 ret i32 %add 67 } 68