blob: 6f0d524907867bb04c5132a4a4dcab08da373752 [file] [log] [blame]
Sanjay Patelc0218922017-11-19 17:31:37 +00001; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
4; PR31455 - https://bugs.llvm.org/show_bug.cgi?id=31455
5; We have to assume that errno can be set, so we have to make a libcall in that case.
Sanjay Patel0de1a4b2017-11-27 21:15:43 +00006; But it's better for perf to check that the argument is valid rather than the result of
Sanjay Patelc0218922017-11-19 17:31:37 +00007; sqrtss/sqrtsd.
8; Note: This is really a test of the -partially-inline-libcalls IR pass (and we have an IR test
9; for that), but we're checking the final asm to make sure that comes out as expected too.
10
11define float @f(float %val) nounwind {
12; CHECK-LABEL: f:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000013; CHECK: # %bb.0:
Sanjay Patel0de1a4b2017-11-27 21:15:43 +000014; CHECK-NEXT: xorps %xmm1, %xmm1
15; CHECK-NEXT: ucomiss %xmm1, %xmm0
16; CHECK-NEXT: jb .LBB0_2
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000017; CHECK-NEXT: # %bb.1: # %.split
Sanjay Patel0de1a4b2017-11-27 21:15:43 +000018; CHECK-NEXT: sqrtss %xmm0, %xmm0
Sanjay Patelc0218922017-11-19 17:31:37 +000019; CHECK-NEXT: retq
20; CHECK-NEXT: .LBB0_2: # %call.sqrt
21; CHECK-NEXT: jmp sqrtf # TAILCALL
22 %res = tail call float @sqrtf(float %val)
23 ret float %res
24}
25
26define double @d(double %val) nounwind {
27; CHECK-LABEL: d:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000028; CHECK: # %bb.0:
Sanjay Patel0de1a4b2017-11-27 21:15:43 +000029; CHECK-NEXT: xorps %xmm1, %xmm1
30; CHECK-NEXT: ucomisd %xmm1, %xmm0
31; CHECK-NEXT: jb .LBB1_2
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000032; CHECK-NEXT: # %bb.1: # %.split
Sanjay Patel0de1a4b2017-11-27 21:15:43 +000033; CHECK-NEXT: sqrtsd %xmm0, %xmm0
Sanjay Patelc0218922017-11-19 17:31:37 +000034; CHECK-NEXT: retq
35; CHECK-NEXT: .LBB1_2: # %call.sqrt
36; CHECK-NEXT: jmp sqrt # TAILCALL
37 %res = tail call double @sqrt(double %val)
38 ret double %res
39}
40
41declare float @sqrtf(float)
42declare double @sqrt(double)
43