xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/sqrt.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2                             | FileCheck %s --check-prefix=SSE2
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=SSE2
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx                             | FileCheck %s --check-prefix=AVX
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=AVX
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine float @test_sqrt_f32(float %a) {
7*9880d681SAndroid Build Coastguard Worker; SSE2-LABEL: test_sqrt_f32
8*9880d681SAndroid Build Coastguard Worker; SSE2:       sqrtss %xmm0, %xmm0
9*9880d681SAndroid Build Coastguard Worker; AVX-LABEL:  test_sqrt_f32
10*9880d681SAndroid Build Coastguard Worker; AVX:        vsqrtss %xmm0, %xmm0
11*9880d681SAndroid Build Coastguard Worker  %res = call float @llvm.sqrt.f32(float %a)
12*9880d681SAndroid Build Coastguard Worker  ret float %res
13*9880d681SAndroid Build Coastguard Worker}
14*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.sqrt.f32(float) nounwind readnone
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine double @test_sqrt_f64(double %a) {
17*9880d681SAndroid Build Coastguard Worker; SSE2-LABEL: test_sqrt_f64
18*9880d681SAndroid Build Coastguard Worker; SSE2:       sqrtsd %xmm0, %xmm0
19*9880d681SAndroid Build Coastguard Worker; AVX-LABEL:  test_sqrt_f64
20*9880d681SAndroid Build Coastguard Worker; AVX:        vsqrtsd %xmm0, %xmm0
21*9880d681SAndroid Build Coastguard Worker  %res = call double @llvm.sqrt.f64(double %a)
22*9880d681SAndroid Build Coastguard Worker  ret double %res
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.sqrt.f64(double) nounwind readnone
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker
27