2012-05-29 05:48:37 +08:00
|
|
|
; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
|
|
|
|
; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
|
|
|
|
|
|
|
|
define ptx_device float @test_fabsf(float %f) {
|
2013-05-31 20:14:49 +08:00
|
|
|
; CHECK: abs.f32 %f{{[0-9]+}}, %f{{[0-9]+}};
|
2012-05-29 05:48:37 +08:00
|
|
|
; CHECK: ret;
|
|
|
|
%x = call float @llvm.fabs.f32(float %f)
|
|
|
|
ret float %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device double @test_fabs(double %d) {
|
2014-07-17 00:26:58 +08:00
|
|
|
; CHECK: abs.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}};
|
2012-05-29 05:48:37 +08:00
|
|
|
; CHECK: ret;
|
|
|
|
%x = call double @llvm.fabs.f64(double %d)
|
|
|
|
ret double %x
|
|
|
|
}
|
|
|
|
|
2013-05-22 00:51:30 +08:00
|
|
|
define float @test_nvvm_sqrt(float %a) {
|
2015-06-24 02:22:17 +08:00
|
|
|
; CHECK: sqrt.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}};
|
|
|
|
; CHECK: ret;
|
2013-05-22 00:51:30 +08:00
|
|
|
%val = call float @llvm.nvvm.sqrt.f(float %a)
|
|
|
|
ret float %val
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-29 05:48:37 +08:00
|
|
|
declare float @llvm.fabs.f32(float)
|
|
|
|
declare double @llvm.fabs.f64(double)
|
2013-05-22 00:51:30 +08:00
|
|
|
declare float @llvm.nvvm.sqrt.f(float)
|