llvm-6502/test/CodeGen/PTX/20110926-sitofp.ll
Justin Holewinski 13e0c805a2 PTX: Add support for sitofp in backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140593 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 01:04:47 +00:00

25 lines
970 B
LLVM

; RUN: llc < %s -march=ptx32 | FileCheck %s
@A = common global [1536 x [1536 x float]] zeroinitializer, align 4
@B = common global [1536 x [1536 x float]] zeroinitializer, align 4
define internal ptx_device void @init_array(i32 %x, i32 %y) {
%arrayidx103 = getelementptr [1536 x [1536 x float]]* @A, i32 0, i32 %x, i32 %y
%arrayidx224 = getelementptr [1536 x [1536 x float]]* @B, i32 0, i32 %x, i32 %y
%mul5 = mul i32 %x, %y
%rem = srem i32 %mul5, 1024
%add = add nsw i32 %rem, 1
; CHECK: cvt.rn.f64.s32 %fd{{[0-9]+}}, %r{{[0-9]+}}
%conv = sitofp i32 %add to double
%div = fmul double %conv, 5.000000e-01
%conv7 = fptrunc double %div to float
store float %conv7, float* %arrayidx103, align 4
%rem14 = srem i32 %mul5, 1024
%add15 = add nsw i32 %rem14, 1
%conv16 = sitofp i32 %add15 to double
%div17 = fmul double %conv16, 5.000000e-01
%conv18 = fptrunc double %div17 to float
store float %conv18, float* %arrayidx224, align 4
ret void
}