1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mcpu=a2 < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-m:e-i64:64-n32:64" 3*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu" 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readonly 6*9880d681SAndroid Build Coastguard Workerdefine double @test1(i64* nocapture readonly %x) #0 { 7*9880d681SAndroid Build Coastguard Workerentry: 8*9880d681SAndroid Build Coastguard Worker %0 = load i64, i64* %x, align 8 9*9880d681SAndroid Build Coastguard Worker %conv = sitofp i64 %0 to double 10*9880d681SAndroid Build Coastguard Worker ret double %conv 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test1 13*9880d681SAndroid Build Coastguard Worker; CHECK: lfd [[REG1:[0-9]+]], 0(3) 14*9880d681SAndroid Build Coastguard Worker; CHECK: fcfid 1, [[REG1]] 15*9880d681SAndroid Build Coastguard Worker; CHECK: blr 16*9880d681SAndroid Build Coastguard Worker} 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readonly 19*9880d681SAndroid Build Coastguard Workerdefine double @test2(i32* nocapture readonly %x) #0 { 20*9880d681SAndroid Build Coastguard Workerentry: 21*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %x, align 4 22*9880d681SAndroid Build Coastguard Worker %conv = sitofp i32 %0 to double 23*9880d681SAndroid Build Coastguard Worker ret double %conv 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test2 26*9880d681SAndroid Build Coastguard Worker; CHECK: lfiwax [[REG1:[0-9]+]], 0, 3 27*9880d681SAndroid Build Coastguard Worker; CHECK: fcfid 1, [[REG1]] 28*9880d681SAndroid Build Coastguard Worker; CHECK: blr 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 32*9880d681SAndroid Build Coastguard Workerdefine float @foo(float %X) #0 { 33*9880d681SAndroid Build Coastguard Workerentry: 34*9880d681SAndroid Build Coastguard Worker %conv = fptosi float %X to i32 35*9880d681SAndroid Build Coastguard Worker %conv1 = sitofp i32 %conv to float 36*9880d681SAndroid Build Coastguard Worker ret float %conv1 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foo 39*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fctiwz [[REG2:[0-9]+]], 1 40*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG1:[0-9]+]], 1, 41*9880d681SAndroid Build Coastguard Worker; CHECK: stfiwx [[REG2]], 0, [[REG1]] 42*9880d681SAndroid Build Coastguard Worker; CHECK: lfiwax [[REG3:[0-9]+]], 0, [[REG1]] 43*9880d681SAndroid Build Coastguard Worker; CHECK: fcfids 1, [[REG3]] 44*9880d681SAndroid Build Coastguard Worker; CHECK: blr 45*9880d681SAndroid Build Coastguard Worker} 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 48*9880d681SAndroid Build Coastguard Workerdefine double @food(double %X) #0 { 49*9880d681SAndroid Build Coastguard Workerentry: 50*9880d681SAndroid Build Coastguard Worker %conv = fptosi double %X to i32 51*9880d681SAndroid Build Coastguard Worker %conv1 = sitofp i32 %conv to double 52*9880d681SAndroid Build Coastguard Worker ret double %conv1 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @food 55*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fctiwz [[REG2:[0-9]+]], 1 56*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG1:[0-9]+]], 1, 57*9880d681SAndroid Build Coastguard Worker; CHECK: stfiwx [[REG2]], 0, [[REG1]] 58*9880d681SAndroid Build Coastguard Worker; CHECK: lfiwax [[REG3:[0-9]+]], 0, [[REG1]] 59*9880d681SAndroid Build Coastguard Worker; CHECK: fcfid 1, [[REG3]] 60*9880d681SAndroid Build Coastguard Worker; CHECK: blr 61*9880d681SAndroid Build Coastguard Worker} 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 64*9880d681SAndroid Build Coastguard Workerdefine float @foou(float %X) #0 { 65*9880d681SAndroid Build Coastguard Workerentry: 66*9880d681SAndroid Build Coastguard Worker %conv = fptoui float %X to i32 67*9880d681SAndroid Build Coastguard Worker %conv1 = uitofp i32 %conv to float 68*9880d681SAndroid Build Coastguard Worker ret float %conv1 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foou 71*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fctiwuz [[REG2:[0-9]+]], 1 72*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG1:[0-9]+]], 1, 73*9880d681SAndroid Build Coastguard Worker; CHECK: stfiwx [[REG2]], 0, [[REG1]] 74*9880d681SAndroid Build Coastguard Worker; CHECK: lfiwzx [[REG3:[0-9]+]], 0, [[REG1]] 75*9880d681SAndroid Build Coastguard Worker; CHECK: fcfidus 1, [[REG3]] 76*9880d681SAndroid Build Coastguard Worker; CHECK: blr 77*9880d681SAndroid Build Coastguard Worker} 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 80*9880d681SAndroid Build Coastguard Workerdefine double @fooud(double %X) #0 { 81*9880d681SAndroid Build Coastguard Workerentry: 82*9880d681SAndroid Build Coastguard Worker %conv = fptoui double %X to i32 83*9880d681SAndroid Build Coastguard Worker %conv1 = uitofp i32 %conv to double 84*9880d681SAndroid Build Coastguard Worker ret double %conv1 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @fooud 87*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fctiwuz [[REG2:[0-9]+]], 1 88*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG1:[0-9]+]], 1, 89*9880d681SAndroid Build Coastguard Worker; CHECK: stfiwx [[REG2]], 0, [[REG1]] 90*9880d681SAndroid Build Coastguard Worker; CHECK: lfiwzx [[REG3:[0-9]+]], 0, [[REG1]] 91*9880d681SAndroid Build Coastguard Worker; CHECK: fcfidu 1, [[REG3]] 92*9880d681SAndroid Build Coastguard Worker; CHECK: blr 93*9880d681SAndroid Build Coastguard Worker} 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readonly } 96*9880d681SAndroid Build Coastguard Worker 97