Skip to content

Commit ca462c8

Browse files
author
mattarde
committed
[X86][GlobalIsel] support fabs for f80
1 parent e0660ed commit ca462c8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,11 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
466466
(UseX87 && typeInSet(0, {s80})(Query));
467467
});
468468

469+
//TODO: f32 and f64 FABS require xmm support
470+
getActionDefinitionsBuilder(G_FABS)
471+
.legalFor(UseX87, {s8, s80})
472+
.lower();
473+
469474
// fp comparison
470475
getActionDefinitionsBuilder(G_FCMP)
471476
.legalFor(HasSSE1 || UseX87, {s8, s32})
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
3+
; RUN: llc < %s -mtriple=x86_64-linux -mattr=+x87,-sse,-sse2 | FileCheck %s -check-prefixes=X64
4+
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel -mattr=+x87,-sse,-sse2 | FileCheck %s -check-prefixes=GISEL
5+
6+
define x86_fp80 @test_x86_fp80_abs(x86_fp80 %arg) {
7+
; X64-LABEL: test_x86_fp80_abs:
8+
; X64: # %bb.0:
9+
; X64-NEXT: fldt {{[0-9]+}}(%rsp)
10+
; X64-NEXT: fabs
11+
; X64-NEXT: retq
12+
;
13+
; GISEL-LABEL: test_x86_fp80_abs:
14+
; GISEL: # %bb.0:
15+
; GISEL-NEXT: fldt {{[0-9]+}}(%rsp)
16+
; GISEL-NEXT: fabs
17+
; GISEL-NEXT: retq
18+
%abs = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %arg)
19+
ret x86_fp80 %abs
20+
}

0 commit comments

Comments
 (0)