blob: 05776886dd947300c8bd23cb7ca3f2f2b169484a [file] [log] [blame]
Daniel Sanders1b334172015-10-06 15:17:25 +00001; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -mattr=+micromips | FileCheck %s
2; RUN: llc < %s -march=mips -mcpu=mips32r2 -mattr=+micromips | FileCheck %s
3; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips | FileCheck %s
Stefan Maksimovic98749e02018-01-23 10:09:39 +00004; RUN: llc -march=mips -mcpu=mips32 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32
5; RUN: llc -march=mips -mcpu=mips32r2 -mattr=+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32FP64
6; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MM
7; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+micromips,+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MMFP64
8; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MMR6
Daniel Sanders1b334172015-10-06 15:17:25 +00009
10define float @sqrt_fn(float %value) #0 {
11entry:
12 %sqrtf = tail call float @sqrtf(float %value) #0
13 ret float %sqrtf
14}
15
16declare float @sqrtf(float)
17
18; CHECK: sqrt.s $f0, $f12
Stefan Maksimovic98749e02018-01-23 10:09:39 +000019
20
21define float @sqrt_s(float %a) {
22; MIPS32: sqrt.s {{.*}} # <MCInst #{{[0-9]+}} FSQRT_S
23; MIPS32FP64: sqrt.s {{.*}} # <MCInst #{{[0-9]+}} FSQRT_S
24; MM: sqrt.s {{.*}} # <MCInst #{{[0-9]+}} FSQRT_S_MM
25; MMFP64: sqrt.s {{.*}} # <MCInst #{{[0-9]+}} FSQRT_S_MM
26; MMR6: sqrt.s {{.*}} # <MCInst #{{[0-9]+}} FSQRT_S_MM
27 %ret = call float @llvm.sqrt.f32(float %a)
28 ret float %ret
29}
30
31define double @sqrt_d(double %a) {
32; MIPS32: sqrt.d {{.*}} # <MCInst #{{[0-9]+}} FSQRT_D32
33; MIPS32FP64: sqrt.d {{.*}} # <MCInst #{{[0-9]+}} FSQRT_D64
34; MM: sqrt.d {{.*}} # <MCInst #{{[0-9]+}} FSQRT_D32_MM
35; MMFP64: sqrt.d {{.*}} # <MCInst #{{[0-9]+}} FSQRT_D64_MM
36; MMR6: sqrt.d {{.*}} # <MCInst #{{[0-9]+}} FSQRT_D64_MM
37 %ret = call double @llvm.sqrt.f64(double %a)
38 ret double %ret
39}
40
41declare float @llvm.sqrt.f32(float %a)
42declare double @llvm.sqrt.f64(double %a)