-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hexagon: add target builtins to kernel
Add the compiler-rt builtins like memcpy to the hexagon kernel. Signed-off-by: Sid Manning <sidneym@codeaurora.org> Add SYM_FUNC_START/END, ksyms exports Signed-off-by: Brian Cain <bcain@codeaurora.org> Tested-by: Nick Desaulniers <ndesaulniers@google.com>
- Loading branch information
Sid Manning
authored and
Brian Cain
committed
May 3, 2021
1 parent
aaa4495
commit f1f99ad
Showing
8 changed files
with
249 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (c) 2021, The Linux Foundation. All rights reserved. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
|
||
SYM_FUNC_START(__hexagon_divsi3) | ||
{ | ||
p0 = cmp.gt(r0,#-1) | ||
p1 = cmp.gt(r1,#-1) | ||
r3:2 = vabsw(r1:0) | ||
} | ||
{ | ||
p3 = xor(p0,p1) | ||
r4 = sub(r2,r3) | ||
r6 = cl0(r2) | ||
p0 = cmp.gtu(r3,r2) | ||
} | ||
{ | ||
r0 = mux(p3,#-1,#1) | ||
r7 = cl0(r3) | ||
p1 = cmp.gtu(r3,r4) | ||
} | ||
{ | ||
r0 = mux(p0,#0,r0) | ||
p0 = or(p0,p1) | ||
if (p0.new) jumpr:nt r31 | ||
r6 = sub(r7,r6) | ||
} | ||
{ | ||
r7 = r6 | ||
r5:4 = combine(#1,r3) | ||
r6 = add(#1,lsr(r6,#1)) | ||
p0 = cmp.gtu(r6,#4) | ||
} | ||
{ | ||
r5:4 = vaslw(r5:4,r7) | ||
if (!p0) r6 = #3 | ||
} | ||
{ | ||
loop0(1f,r6) | ||
r7:6 = vlsrw(r5:4,#1) | ||
r1:0 = #0 | ||
} | ||
.falign | ||
1: | ||
{ | ||
r5:4 = vlsrw(r5:4,#2) | ||
if (!p0.new) r0 = add(r0,r5) | ||
if (!p0.new) r2 = sub(r2,r4) | ||
p0 = cmp.gtu(r4,r2) | ||
} | ||
{ | ||
r7:6 = vlsrw(r7:6,#2) | ||
if (!p0.new) r0 = add(r0,r7) | ||
if (!p0.new) r2 = sub(r2,r6) | ||
p0 = cmp.gtu(r6,r2) | ||
}:endloop0 | ||
{ | ||
if (!p0) r0 = add(r0,r7) | ||
} | ||
{ | ||
if (p3) r0 = sub(r1,r0) | ||
jumpr r31 | ||
} | ||
SYM_FUNC_END(__hexagon_divsi3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (c) 2021, The Linux Foundation. All rights reserved. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
|
||
SYM_FUNC_START(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes) | ||
{ | ||
p0 = bitsclr(r1,#7) | ||
p0 = bitsclr(r0,#7) | ||
if (p0.new) r5:4 = memd(r1) | ||
if (p0.new) r7:6 = memd(r1+#8) | ||
} | ||
{ | ||
if (!p0) jump:nt .Lmemcpy_call | ||
if (p0) r9:8 = memd(r1+#16) | ||
if (p0) r11:10 = memd(r1+#24) | ||
p0 = cmp.gtu(r2,#64) | ||
} | ||
{ | ||
if (p0) jump:nt .Lmemcpy_call | ||
if (!p0) memd(r0) = r5:4 | ||
if (!p0) memd(r0+#8) = r7:6 | ||
p0 = cmp.gtu(r2,#32) | ||
} | ||
{ | ||
p1 = cmp.gtu(r2,#40) | ||
p2 = cmp.gtu(r2,#48) | ||
if (p0) r13:12 = memd(r1+#32) | ||
if (p1.new) r15:14 = memd(r1+#40) | ||
} | ||
{ | ||
memd(r0+#16) = r9:8 | ||
memd(r0+#24) = r11:10 | ||
} | ||
{ | ||
if (p0) memd(r0+#32) = r13:12 | ||
if (p1) memd(r0+#40) = r15:14 | ||
if (!p2) jumpr:t r31 | ||
} | ||
{ | ||
p0 = cmp.gtu(r2,#56) | ||
r5:4 = memd(r1+#48) | ||
if (p0.new) r7:6 = memd(r1+#56) | ||
} | ||
{ | ||
memd(r0+#48) = r5:4 | ||
if (p0) memd(r0+#56) = r7:6 | ||
jumpr r31 | ||
} | ||
|
||
.Lmemcpy_call: | ||
jump memcpy | ||
|
||
SYM_FUNC_END(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (c) 2021, The Linux Foundation. All rights reserved. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
|
||
SYM_FUNC_START(__hexagon_modsi3) | ||
{ | ||
p2 = cmp.ge(r0,#0) | ||
r2 = abs(r0) | ||
r1 = abs(r1) | ||
} | ||
{ | ||
r3 = cl0(r2) | ||
r4 = cl0(r1) | ||
p0 = cmp.gtu(r1,r2) | ||
} | ||
{ | ||
r3 = sub(r4,r3) | ||
if (p0) jumpr r31 | ||
} | ||
{ | ||
p1 = cmp.eq(r3,#0) | ||
loop0(1f,r3) | ||
r0 = r2 | ||
r2 = lsl(r1,r3) | ||
} | ||
.falign | ||
1: | ||
{ | ||
p0 = cmp.gtu(r2,r0) | ||
if (!p0.new) r0 = sub(r0,r2) | ||
r2 = lsr(r2,#1) | ||
if (p1) r1 = #0 | ||
}:endloop0 | ||
{ | ||
p0 = cmp.gtu(r2,r0) | ||
if (!p0.new) r0 = sub(r0,r1) | ||
if (p2) jumpr r31 | ||
} | ||
{ | ||
r0 = neg(r0) | ||
jumpr r31 | ||
} | ||
SYM_FUNC_END(__hexagon_modsi3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (c) 2021, The Linux Foundation. All rights reserved. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
|
||
SYM_FUNC_START(__hexagon_udivsi3) | ||
{ | ||
r2 = cl0(r0) | ||
r3 = cl0(r1) | ||
r5:4 = combine(#1,#0) | ||
p0 = cmp.gtu(r1,r0) | ||
} | ||
{ | ||
r6 = sub(r3,r2) | ||
r4 = r1 | ||
r1:0 = combine(r0,r4) | ||
if (p0) jumpr r31 | ||
} | ||
{ | ||
r3:2 = vlslw(r5:4,r6) | ||
loop0(1f,r6) | ||
} | ||
.falign | ||
1: | ||
{ | ||
p0 = cmp.gtu(r2,r1) | ||
if (!p0.new) r1 = sub(r1,r2) | ||
if (!p0.new) r0 = add(r0,r3) | ||
r3:2 = vlsrw(r3:2,#1) | ||
}:endloop0 | ||
{ | ||
p0 = cmp.gtu(r2,r1) | ||
if (!p0.new) r0 = add(r0,r3) | ||
jumpr r31 | ||
} | ||
SYM_FUNC_END(__hexagon_udivsi3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (c) 2021, The Linux Foundation. All rights reserved. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
|
||
SYM_FUNC_START(__hexagon_umodsi3) | ||
{ | ||
r2 = cl0(r0) | ||
r3 = cl0(r1) | ||
p0 = cmp.gtu(r1,r0) | ||
} | ||
{ | ||
r2 = sub(r3,r2) | ||
if (p0) jumpr r31 | ||
} | ||
{ | ||
loop0(1f,r2) | ||
p1 = cmp.eq(r2,#0) | ||
r2 = lsl(r1,r2) | ||
} | ||
.falign | ||
1: | ||
{ | ||
p0 = cmp.gtu(r2,r0) | ||
if (!p0.new) r0 = sub(r0,r2) | ||
r2 = lsr(r2,#1) | ||
if (p1) r1 = #0 | ||
}:endloop0 | ||
{ | ||
p0 = cmp.gtu(r2,r0) | ||
if (!p0.new) r0 = sub(r0,r1) | ||
jumpr r31 | ||
} | ||
SYM_FUNC_END(__hexagon_umodsi3) |