1*9880d681SAndroid Build Coastguard Worker; Test moves between FPRs and GPRs for z13 and above. 2*9880d681SAndroid Build Coastguard Worker; 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Check that moves from i32s to floats use a low GR32 and vector operation. 6*9880d681SAndroid Build Coastguard Workerdefine float @f1(i16 *%ptr) { 7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1: 8*9880d681SAndroid Build Coastguard Worker; CHECK: llh [[REG:%r[0-5]]], 0(%r2) 9*9880d681SAndroid Build Coastguard Worker; CHECK: oilh [[REG]], 16256 10*9880d681SAndroid Build Coastguard Worker; CHECK: vlvgf %v0, [[REG]], 0 11*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 12*9880d681SAndroid Build Coastguard Worker %base = load i16, i16 *%ptr 13*9880d681SAndroid Build Coastguard Worker %ext = zext i16 %base to i32 14*9880d681SAndroid Build Coastguard Worker %full = or i32 %ext, 1065353216 15*9880d681SAndroid Build Coastguard Worker %res = bitcast i32 %full to float 16*9880d681SAndroid Build Coastguard Worker ret float %res 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker; Check that moves from floats to i32s use a low GR32 and vector operation. 20*9880d681SAndroid Build Coastguard Workerdefine void @f2(float %val, i8 *%ptr) { 21*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2: 22*9880d681SAndroid Build Coastguard Worker; CHECK: vlgvf [[REG:%r[0-5]]], %v0, 0 23*9880d681SAndroid Build Coastguard Worker; CHECK: stc [[REG]], 0(%r2) 24*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 25*9880d681SAndroid Build Coastguard Worker %res = bitcast float %val to i32 26*9880d681SAndroid Build Coastguard Worker %trunc = trunc i32 %res to i8 27*9880d681SAndroid Build Coastguard Worker store i8 %trunc, i8 *%ptr 28*9880d681SAndroid Build Coastguard Worker ret void 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker; Like f2, but with a conditional store. 32*9880d681SAndroid Build Coastguard Workerdefine void @f3(float %val, i8 *%ptr, i32 %which) { 33*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3: 34*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ciblh %r3, 0, 0(%r14) 35*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vlgvf [[REG:%r[0-5]]], %v0, 0 36*9880d681SAndroid Build Coastguard Worker; CHECK: stc [[REG]], 0(%r2) 37*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 38*9880d681SAndroid Build Coastguard Worker %int = bitcast float %val to i32 39*9880d681SAndroid Build Coastguard Worker %trunc = trunc i32 %int to i8 40*9880d681SAndroid Build Coastguard Worker %old = load i8, i8 *%ptr 41*9880d681SAndroid Build Coastguard Worker %cmp = icmp eq i32 %which, 0 42*9880d681SAndroid Build Coastguard Worker %res = select i1 %cmp, i8 %trunc, i8 %old 43*9880d681SAndroid Build Coastguard Worker store i8 %res, i8 *%ptr 44*9880d681SAndroid Build Coastguard Worker ret void 45*9880d681SAndroid Build Coastguard Worker} 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker; ...and again with 16-bit memory. 48*9880d681SAndroid Build Coastguard Workerdefine void @f4(float %val, i16 *%ptr, i32 %which) { 49*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4: 50*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ciblh %r3, 0, 0(%r14) 51*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vlgvf [[REG:%r[0-5]]], %v0, 0 52*9880d681SAndroid Build Coastguard Worker; CHECK: sth [[REG]], 0(%r2) 53*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 54*9880d681SAndroid Build Coastguard Worker %int = bitcast float %val to i32 55*9880d681SAndroid Build Coastguard Worker %trunc = trunc i32 %int to i16 56*9880d681SAndroid Build Coastguard Worker %old = load i16, i16 *%ptr 57*9880d681SAndroid Build Coastguard Worker %cmp = icmp eq i32 %which, 0 58*9880d681SAndroid Build Coastguard Worker %res = select i1 %cmp, i16 %trunc, i16 %old 59*9880d681SAndroid Build Coastguard Worker store i16 %res, i16 *%ptr 60*9880d681SAndroid Build Coastguard Worker ret void 61*9880d681SAndroid Build Coastguard Worker} 62