1*9880d681SAndroid Build Coastguard Worker; Test floating-point negation. 2*9880d681SAndroid Build Coastguard Worker; 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; Test f32. 7*9880d681SAndroid Build Coastguard Workerdefine float @f1(float %f) { 8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1: 9*9880d681SAndroid Build Coastguard Worker; CHECK: lcdfr %f0, %f0 10*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 11*9880d681SAndroid Build Coastguard Worker %res = fsub float -0.0, %f 12*9880d681SAndroid Build Coastguard Worker ret float %res 13*9880d681SAndroid Build Coastguard Worker} 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; Test f64. 16*9880d681SAndroid Build Coastguard Workerdefine double @f2(double %f) { 17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2: 18*9880d681SAndroid Build Coastguard Worker; CHECK: lcdfr %f0, %f0 19*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 20*9880d681SAndroid Build Coastguard Worker %res = fsub double -0.0, %f 21*9880d681SAndroid Build Coastguard Worker ret double %res 22*9880d681SAndroid Build Coastguard Worker} 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; Test f128. With the loads and stores, a pure negation would probably 25*9880d681SAndroid Build Coastguard Worker; be better implemented using an XI on the upper byte. Do some extra 26*9880d681SAndroid Build Coastguard Worker; processing so that using FPRs is unequivocally better. 27*9880d681SAndroid Build Coastguard Workerdefine void @f3(fp128 *%ptr, fp128 *%ptr2) { 28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3: 29*9880d681SAndroid Build Coastguard Worker; CHECK: lcxbr 30*9880d681SAndroid Build Coastguard Worker; CHECK: dxbr 31*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 32*9880d681SAndroid Build Coastguard Worker %orig = load fp128 , fp128 *%ptr 33*9880d681SAndroid Build Coastguard Worker %negzero = fpext float -0.0 to fp128 34*9880d681SAndroid Build Coastguard Worker %neg = fsub fp128 0xL00000000000000008000000000000000, %orig 35*9880d681SAndroid Build Coastguard Worker %op2 = load fp128 , fp128 *%ptr2 36*9880d681SAndroid Build Coastguard Worker %res = fdiv fp128 %neg, %op2 37*9880d681SAndroid Build Coastguard Worker store fp128 %res, fp128 *%ptr 38*9880d681SAndroid Build Coastguard Worker ret void 39*9880d681SAndroid Build Coastguard Worker} 40