Skip to content

Commit 7e4029d

Browse files
[X86][NFC] Added/Updated SQRT function testcases (#132205)
- Added test for x86_fp80 type for SQRT. - Added global-isel runs as precommit testing for SQRT.
1 parent fe6bced commit 7e4029d

File tree

2 files changed

+74
-37
lines changed

2 files changed

+74
-37
lines changed

llvm/test/CodeGen/X86/isel-sqrt.ll

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 | FileCheck %s --check-prefixes=X64,SSE2
3+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 -fast-isel | FileCheck %s --check-prefixes=X64,SSE2
4+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx,+sse2 -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,SSE2
5+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx | FileCheck %s --check-prefixes=X64,AVX
6+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx -fast-isel | FileCheck %s --check-prefixes=X64,AVX
7+
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-avx2,+avx -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,AVX
8+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 -fast-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86
9+
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86,FASTISEL-X86
10+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86
11+
12+
define float @test_sqrt_f32(float %a) {
13+
; SSE2-LABEL: test_sqrt_f32:
14+
; SSE2: ## %bb.0:
15+
; SSE2-NEXT: sqrtss %xmm0, %xmm0
16+
; SSE2-NEXT: retq
17+
;
18+
; AVX-LABEL: test_sqrt_f32:
19+
; AVX: ## %bb.0:
20+
; AVX-NEXT: vsqrtss %xmm0, %xmm0, %xmm0
21+
; 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
28+
%res = call float @llvm.sqrt.f32(float %a)
29+
ret float %res
30+
}
31+
declare float @llvm.sqrt.f32(float) nounwind readnone
32+
33+
define double @test_sqrt_f64(double %a) {
34+
; SSE2-LABEL: test_sqrt_f64:
35+
; SSE2: ## %bb.0:
36+
; SSE2-NEXT: sqrtsd %xmm0, %xmm0
37+
; SSE2-NEXT: retq
38+
;
39+
; AVX-LABEL: test_sqrt_f64:
40+
; AVX: ## %bb.0:
41+
; AVX-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0
42+
; 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
49+
%res = call double @llvm.sqrt.f64(double %a)
50+
ret double %res
51+
}
52+
declare double @llvm.sqrt.f64(double) nounwind readnone
53+
54+
define x86_fp80 @test_sqrt_f80(x86_fp80 %a) {
55+
; X64-LABEL: test_sqrt_f80:
56+
; X64: ## %bb.0:
57+
; X64-NEXT: fldt {{[0-9]+}}(%rsp)
58+
; X64-NEXT: fsqrt
59+
; X64-NEXT: retq
60+
;
61+
; X86-LABEL: test_sqrt_f80:
62+
; X86: # %bb.0:
63+
; X86-NEXT: fldt {{[0-9]+}}(%esp)
64+
; X86-NEXT: fsqrt
65+
; X86-NEXT: retl
66+
%res = call x86_fp80 @llvm.sqrt.f80(x86_fp80 %a)
67+
ret x86_fp80 %res
68+
}
69+
declare x86_fp80 @llvm.sqrt.f80(x86_fp80) nounwind readnone
70+
71+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
72+
; FASTISEL-X86: {{.*}}
73+
; GISEL-X86: {{.*}}
74+
; SDAG-X86: {{.*}}

llvm/test/CodeGen/X86/sqrt.ll

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)