xref: /llvm-project/llvm/test/CodeGen/ARM/pow.ll (revision ba2c62553109e324a203aa46c2217cf5f28ab694)
1dbf52837SSanjay Patel; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2dbf52837SSanjay Patel; RUN: llc < %s -mtriple=thumbv7m-linux-gnueabi              | FileCheck %s --check-prefixes=ANY,SOFTFLOAT
3dbf52837SSanjay Patel; RUN: llc < %s -mtriple=thumbv8-linux-gnueabihf -mattr=neon | FileCheck %s --check-prefixes=ANY,HARDFLOAT
4dbf52837SSanjay Patel
5dbf52837SSanjay Pateldeclare float @llvm.pow.f32(float, float)
6dbf52837SSanjay Pateldeclare <4 x float> @llvm.pow.v4f32(<4 x float>, <4 x float>)
7dbf52837SSanjay Patel
8dbf52837SSanjay Pateldeclare double @llvm.pow.f64(double, double)
9dbf52837SSanjay Pateldeclare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>)
10dbf52837SSanjay Patel
11dbf52837SSanjay Pateldefine float @pow_f32_one_fourth_fmf(float %x) nounwind {
12dbf52837SSanjay Patel; ANY-LABEL: pow_f32_one_fourth_fmf:
13dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
14dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
15dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
16dbf52837SSanjay Patel  %r = call nsz ninf afn float @llvm.pow.f32(float %x, float 2.5e-01)
17dbf52837SSanjay Patel  ret float %r
18dbf52837SSanjay Patel}
19dbf52837SSanjay Patel
20dbf52837SSanjay Pateldefine double @pow_f64_one_fourth_fmf(double %x) nounwind {
21dbf52837SSanjay Patel; ANY-LABEL: pow_f64_one_fourth_fmf:
22dbf52837SSanjay Patel; SOFTFLOAT:    bl pow
23dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
24dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
25dbf52837SSanjay Patel  %r = call nsz ninf afn double @llvm.pow.f64(double %x, double 2.5e-01)
26dbf52837SSanjay Patel  ret double %r
27dbf52837SSanjay Patel}
28dbf52837SSanjay Patel
29*ba2c6255SDavid Greendefine float @pow_f32_one_third_fmf(float %x) nounwind {
30*ba2c6255SDavid Green; ANY-LABEL: pow_f32_one_third_fmf:
31*ba2c6255SDavid Green; SOFTFLOAT:    bl cbrtf
32*ba2c6255SDavid Green; HARDFLOAT:    b cbrtf
33*ba2c6255SDavid Green  %r = call fast float @llvm.pow.f32(float %x, float 0x3FD5555560000000)
34*ba2c6255SDavid Green  ret float %r
35*ba2c6255SDavid Green}
36*ba2c6255SDavid Green
37*ba2c6255SDavid Greendefine double @pow_f64_one_third_fmf(double %x) nounwind {
38*ba2c6255SDavid Green; ANY-LABEL: pow_f64_one_third_fmf:
39*ba2c6255SDavid Green; SOFTFLOAT:    bl cbrt
40*ba2c6255SDavid Green; HARDFLOAT:    b cbrt
41*ba2c6255SDavid Green  %r = call fast double @llvm.pow.f64(double %x, double 0x3FD5555555555555)
42*ba2c6255SDavid Green  ret double %r
43*ba2c6255SDavid Green}
44*ba2c6255SDavid Green
45dbf52837SSanjay Pateldefine <4 x float> @pow_v4f32_one_fourth_fmf(<4 x float> %x) nounwind {
46dbf52837SSanjay Patel; ANY-LABEL: pow_v4f32_one_fourth_fmf:
47dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
48dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
49dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
50dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
51dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
52dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
53dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
54dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
55dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
56dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
57dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
58dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f32
59dbf52837SSanjay Patel  %r = call fast <4 x float> @llvm.pow.v4f32(<4 x float> %x, <4 x float> <float 2.5e-1, float 2.5e-1, float 2.5e-01, float 2.5e-01>)
60dbf52837SSanjay Patel  ret <4 x float> %r
61dbf52837SSanjay Patel}
62dbf52837SSanjay Patel
63dbf52837SSanjay Pateldefine <2 x double> @pow_v2f64_one_fourth_fmf(<2 x double> %x) nounwind {
64dbf52837SSanjay Patel; ANY-LABEL: pow_v2f64_one_fourth_fmf:
65dbf52837SSanjay Patel; SOFTFLOAT:    bl pow
66dbf52837SSanjay Patel; SOFTFLOAT:    bl pow
67dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
68dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
69dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
70dbf52837SSanjay Patel; HARDFLOAT:    vsqrt.f64
71dbf52837SSanjay Patel  %r = call fast <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 2.5e-1, double 2.5e-1>)
72dbf52837SSanjay Patel  ret <2 x double> %r
73dbf52837SSanjay Patel}
74dbf52837SSanjay Patel
75dbf52837SSanjay Pateldefine float @pow_f32_one_fourth_not_enough_fmf(float %x) nounwind {
76dbf52837SSanjay Patel; ANY-LABEL: pow_f32_one_fourth_not_enough_fmf:
77dbf52837SSanjay Patel; SOFTFLOAT:    bl powf
78dbf52837SSanjay Patel; HARDFLOAT:    b powf
79dbf52837SSanjay Patel  %r = call afn ninf float @llvm.pow.f32(float %x, float 2.5e-01)
80dbf52837SSanjay Patel  ret float %r
81dbf52837SSanjay Patel}
82dbf52837SSanjay Patel
83dbf52837SSanjay Pateldefine double @pow_f64_one_fourth_not_enough_fmf(double %x) nounwind {
84dbf52837SSanjay Patel; ANY-LABEL: pow_f64_one_fourth_not_enough_fmf:
85dbf52837SSanjay Patel; SOFTFLOAT:    bl pow
86dbf52837SSanjay Patel; HARDFLOAT:    b pow
87dbf52837SSanjay Patel  %r = call nsz ninf double @llvm.pow.f64(double %x, double 2.5e-01)
88dbf52837SSanjay Patel  ret double %r
89dbf52837SSanjay Patel}
90dbf52837SSanjay Patel
91dbf52837SSanjay Pateldefine <4 x float> @pow_v4f32_one_fourth_not_enough_fmf(<4 x float> %x) nounwind {
92dbf52837SSanjay Patel; ANY-LABEL: pow_v4f32_one_fourth_not_enough_fmf:
93dbf52837SSanjay Patel; ANY:    bl powf
94dbf52837SSanjay Patel; ANY:    bl powf
95dbf52837SSanjay Patel; ANY:    bl powf
96dbf52837SSanjay Patel; ANY:    bl powf
97dbf52837SSanjay Patel  %r = call afn nsz <4 x float> @llvm.pow.v4f32(<4 x float> %x, <4 x float> <float 2.5e-1, float 2.5e-1, float 2.5e-01, float 2.5e-01>)
98dbf52837SSanjay Patel  ret <4 x float> %r
99dbf52837SSanjay Patel}
100dbf52837SSanjay Patel
101dbf52837SSanjay Pateldefine <2 x double> @pow_v2f64_one_fourth_not_enough_fmf(<2 x double> %x) nounwind {
102dbf52837SSanjay Patel; ANY-LABEL: pow_v2f64_one_fourth_not_enough_fmf:
103dbf52837SSanjay Patel; ANY:    bl pow
104dbf52837SSanjay Patel; ANY:    bl pow
105dbf52837SSanjay Patel  %r = call nsz nnan reassoc <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 2.5e-1, double 2.5e-1>)
106dbf52837SSanjay Patel  ret <2 x double> %r
107dbf52837SSanjay Patel}
108dbf52837SSanjay Patel
109