1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 --mattr=+lasx < %s | FileCheck %s
5 define void @sqrt_v8f32(ptr %res, ptr %a0) nounwind {
6 ; CHECK-LABEL: sqrt_v8f32:
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: xvld $xr0, $a1, 0
9 ; CHECK-NEXT: xvfsqrt.s $xr0, $xr0
10 ; CHECK-NEXT: xvst $xr0, $a0, 0
13 %v0 = load <8 x float>, ptr %a0, align 16
14 %sqrt = call <8 x float> @llvm.sqrt.v8f32 (<8 x float> %v0)
15 store <8 x float> %sqrt, ptr %res, align 16
19 define void @sqrt_v4f64(ptr %res, ptr %a0) nounwind {
20 ; CHECK-LABEL: sqrt_v4f64:
21 ; CHECK: # %bb.0: # %entry
22 ; CHECK-NEXT: xvld $xr0, $a1, 0
23 ; CHECK-NEXT: xvfsqrt.d $xr0, $xr0
24 ; CHECK-NEXT: xvst $xr0, $a0, 0
27 %v0 = load <4 x double>, ptr %a0, align 16
28 %sqrt = call <4 x double> @llvm.sqrt.v4f64 (<4 x double> %v0)
29 store <4 x double> %sqrt, ptr %res, align 16
34 define void @one_div_sqrt_v8f32(ptr %res, ptr %a0) nounwind {
35 ; CHECK-LABEL: one_div_sqrt_v8f32:
36 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: xvld $xr0, $a1, 0
38 ; CHECK-NEXT: xvfrsqrt.s $xr0, $xr0
39 ; CHECK-NEXT: xvst $xr0, $a0, 0
42 %v0 = load <8 x float>, ptr %a0, align 16
43 %sqrt = call <8 x float> @llvm.sqrt.v8f32 (<8 x float> %v0)
44 %div = fdiv <8 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>, %sqrt
45 store <8 x float> %div, ptr %res, align 16
49 define void @one_div_sqrt_v4f64(ptr %res, ptr %a0) nounwind {
50 ; CHECK-LABEL: one_div_sqrt_v4f64:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: xvld $xr0, $a1, 0
53 ; CHECK-NEXT: xvfrsqrt.d $xr0, $xr0
54 ; CHECK-NEXT: xvst $xr0, $a0, 0
57 %v0 = load <4 x double>, ptr %a0, align 16
58 %sqrt = call <4 x double> @llvm.sqrt.v4f64 (<4 x double> %v0)
59 %div = fdiv <4 x double> <double 1.0, double 1.0, double 1.0, double 1.0>, %sqrt
60 store <4 x double> %div, ptr %res, align 16
64 declare <8 x float> @llvm.sqrt.v8f32(<8 x float>)
65 declare <4 x double> @llvm.sqrt.v4f64(<4 x double>)