Skip to content

Commit efaa8f7

Browse files
[X86][NFC] Added/Updated SQRT function testcases
1 parent 9dc854c commit efaa8f7

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/test/CodeGen/X86/sqrt.ll

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 | FileCheck %s --check-prefix=SSE2
33
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=SSE2
4+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 -global-isel -global-isel-abort=2 | FileCheck %s --check-prefix=SSE2
45
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx | FileCheck %s --check-prefix=AVX
56
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=AVX
7+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx -global-isel -global-isel-abort=2 | FileCheck %s --check-prefix=AVX
8+
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel=1 | FileCheck %s --check-prefixes=X86,FASTISEL-X86
9+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 -fast-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86
10+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86
611

712
define float @test_sqrt_f32(float %a) {
813
; SSE2-LABEL: test_sqrt_f32:
@@ -14,6 +19,12 @@ define float @test_sqrt_f32(float %a) {
1419
; AVX: ## %bb.0:
1520
; AVX-NEXT: vsqrtss %xmm0, %xmm0, %xmm0
1621
; AVX-NEXT: retq
22+
;
23+
; X86-LABEL: test_sqrt_f32:
24+
; X86: # %bb.0:
25+
; X86-NEXT: flds {{[0-9]+}}(%esp)
26+
; X86-NEXT: fsqrt
27+
; X86-NEXT: retl
1728
%res = call float @llvm.sqrt.f32(float %a)
1829
ret float %res
1930
}
@@ -29,9 +40,41 @@ define double @test_sqrt_f64(double %a) {
2940
; AVX: ## %bb.0:
3041
; AVX-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0
3142
; AVX-NEXT: retq
43+
;
44+
; X86-LABEL: test_sqrt_f64:
45+
; X86: # %bb.0:
46+
; X86-NEXT: fldl {{[0-9]+}}(%esp)
47+
; X86-NEXT: fsqrt
48+
; X86-NEXT: retl
3249
%res = call double @llvm.sqrt.f64(double %a)
3350
ret double %res
3451
}
3552
declare double @llvm.sqrt.f64(double) nounwind readnone
3653

54+
define x86_fp80 @test_sqrt_f80(x86_fp80 %a) {
55+
; SSE2-LABEL: test_sqrt_f80:
56+
; SSE2: ## %bb.0:
57+
; SSE2-NEXT: fldt {{[0-9]+}}(%rsp)
58+
; SSE2-NEXT: fsqrt
59+
; SSE2-NEXT: retq
60+
;
61+
; AVX-LABEL: test_sqrt_f80:
62+
; AVX: ## %bb.0:
63+
; AVX-NEXT: fldt {{[0-9]+}}(%rsp)
64+
; AVX-NEXT: fsqrt
65+
; AVX-NEXT: retq
66+
;
67+
; X86-LABEL: test_sqrt_f80:
68+
; X86: # %bb.0:
69+
; X86-NEXT: fldt {{[0-9]+}}(%esp)
70+
; X86-NEXT: fsqrt
71+
; X86-NEXT: retl
72+
%res = call x86_fp80 @llvm.sqrt.f80(x86_fp80 %a)
73+
ret x86_fp80 %res
74+
}
75+
declare x86_fp80 @llvm.sqrt.f80(x86_fp80) nounwind readnone
3776

77+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
78+
; FASTISEL-X86: {{.*}}
79+
; GISEL-X86: {{.*}}
80+
; SDAG-X86: {{.*}}

0 commit comments

Comments
 (0)