Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 813d120

Browse files
committed
This patch adds support for 16 bit floating point registers to the inline asm register selection on AArch64.
Without this patch, register allocation for the example below fails. define half @test(half %a1, half %a2) #0 { entry: %0 = tail call half asm "sqrshl ${0:h}, ${1:h}, ${2:h}", "=w,w,w" (half %a1, half %a2) #1 ret half %0 } Patch by Florian Hahn. Differential Revision: https://reviews.llvm.org/D25080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286111 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ea453ce commit 813d120

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/Target/AArch64/AArch64ISelLowering.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -4780,6 +4780,8 @@ AArch64TargetLowering::getRegForInlineAsmConstraint(
47804780
return std::make_pair(0U, &AArch64::GPR64commonRegClass);
47814781
return std::make_pair(0U, &AArch64::GPR32commonRegClass);
47824782
case 'w':
4783+
if (VT.getSizeInBits() == 16)
4784+
return std::make_pair(0U, &AArch64::FPR16RegClass);
47834785
if (VT.getSizeInBits() == 32)
47844786
return std::make_pair(0U, &AArch64::FPR32RegClass);
47854787
if (VT.getSizeInBits() == 64)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon < %s | FileCheck %s
2+
3+
; generated from
4+
; __fp16 test(__fp16 a1, __fp16 a2) {
5+
; __fp16 res0;
6+
; __asm__("sqrshl %h[__res], %h[__A], %h[__B]"
7+
; : [__res] "=w" (res0)
8+
; : [__A] "w" (a1), [__B] "w" (a2)
9+
; :
10+
; );
11+
; return res0;
12+
;}
13+
14+
; Function Attrs: nounwind readnone
15+
define half @test(half %a1, half %a2) #0 {
16+
entry:
17+
;CHECK: sqrshl {{h[0-9]+}}, {{h[0-9]+}}, {{h[0-9]+}}
18+
%0 = tail call half asm "sqrshl ${0:h}, ${1:h}, ${2:h}", "=w,w,w" (half %a1, half %a2) #1
19+
ret half %0
20+
}

0 commit comments

Comments
 (0)