2016-06-16 04:33:36 +08:00
|
|
|
; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s
|
2014-07-31 12:10:43 +08:00
|
|
|
; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone -fast-isel < %s | FileCheck %s --check-prefix=FAST
|
2016-06-16 04:33:36 +08:00
|
|
|
; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone -filetype=obj -o %t %s
|
|
|
|
; RUN: llvm-objdump -triple arm64-apple-darwin -d %t | FileCheck %s --check-prefix CHECK-ENCODING
|
|
|
|
|
|
|
|
; CHECK-ENCODING-NOT: <unknown>
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK-ENCODING: mov x16, #281470681743360
|
2016-06-16 04:33:36 +08:00
|
|
|
; CHECK-ENCODING: movk x16, #57005, lsl #16
|
|
|
|
; CHECK-ENCODING: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
|
|
|
|
; One argument will be passed in register, the other will be pushed on the stack.
|
|
|
|
; Return value in x0.
|
|
|
|
define void @jscall_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: jscall_patchpoint_codegen:
|
|
|
|
; CHECK: Ltmp
|
2016-05-07 00:34:59 +08:00
|
|
|
; CHECK: str x{{.+}}, [sp]
|
2014-07-31 12:10:43 +08:00
|
|
|
; CHECK-NEXT: mov x0, x{{.+}}
|
|
|
|
; CHECK: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK-NEXT: mov x16, #281470681743360
|
2016-06-16 04:33:36 +08:00
|
|
|
; CHECK: movk x16, #57005, lsl #16
|
|
|
|
; CHECK: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; CHECK-NEXT: blr x16
|
|
|
|
; FAST-LABEL: jscall_patchpoint_codegen:
|
|
|
|
; FAST: Ltmp
|
2016-05-07 00:34:59 +08:00
|
|
|
; FAST: str x{{.+}}, [sp]
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; FAST-NEXT: mov x16, #281470681743360
|
2016-05-14 02:00:09 +08:00
|
|
|
; FAST-NEXT: movk x16, #57005, lsl #16
|
|
|
|
; FAST-NEXT: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST-NEXT: blr x16
|
|
|
|
%resolveCall2 = inttoptr i64 281474417671919 to i8*
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%result = tail call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 5, i32 20, i8* %resolveCall2, i32 2, i64 %p4, i64 %p2)
|
2014-07-31 12:10:43 +08:00
|
|
|
%resolveCall3 = inttoptr i64 244837814038255 to i8*
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
tail call webkit_jscc void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 6, i32 20, i8* %resolveCall3, i32 2, i64 %p4, i64 %result)
|
2014-07-31 12:10:43 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test if the arguments are properly aligned and that we don't store undef arguments.
|
|
|
|
define i64 @jscall_patchpoint_codegen2(i64 %callee) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: jscall_patchpoint_codegen2:
|
|
|
|
; CHECK: Ltmp
|
|
|
|
; CHECK: orr w[[REG:[0-9]+]], wzr, #0x6
|
|
|
|
; CHECK-NEXT: str x[[REG]], [sp, #24]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x4
|
|
|
|
; CHECK-NEXT: str w[[REG]], [sp, #16]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x2
|
|
|
|
; CHECK-NEXT: str x[[REG]], [sp]
|
|
|
|
; CHECK: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK-NEXT: mov x16, #281470681743360
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK-NEXT: movk x16, #57005, lsl #16
|
|
|
|
; CHECK-NEXT: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; CHECK-NEXT: blr x16
|
|
|
|
; FAST-LABEL: jscall_patchpoint_codegen2:
|
|
|
|
; FAST: Ltmp
|
|
|
|
; FAST: orr [[REG1:x[0-9]+]], xzr, #0x2
|
|
|
|
; FAST-NEXT: orr [[REG2:w[0-9]+]], wzr, #0x4
|
|
|
|
; FAST-NEXT: orr [[REG3:x[0-9]+]], xzr, #0x6
|
2016-05-07 00:34:59 +08:00
|
|
|
; FAST-NEXT: str [[REG1]], [sp]
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST-NEXT: str [[REG2]], [sp, #16]
|
|
|
|
; FAST-NEXT: str [[REG3]], [sp, #24]
|
|
|
|
; FAST: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; FAST-NEXT: mov x16, #281470681743360
|
2016-05-14 02:00:09 +08:00
|
|
|
; FAST-NEXT: movk x16, #57005, lsl #16
|
|
|
|
; FAST-NEXT: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST-NEXT: blr x16
|
|
|
|
%call = inttoptr i64 281474417671919 to i8*
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%result = call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 7, i32 20, i8* %call, i32 6, i64 %callee, i64 2, i64 undef, i32 4, i32 undef, i64 6)
|
2014-07-31 12:10:43 +08:00
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test if the arguments are properly aligned and that we don't store undef arguments.
|
|
|
|
define i64 @jscall_patchpoint_codegen3(i64 %callee) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: jscall_patchpoint_codegen3:
|
|
|
|
; CHECK: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov w[[REG:[0-9]+]], #10
|
2014-07-31 12:10:43 +08:00
|
|
|
; CHECK-NEXT: str x[[REG]], [sp, #48]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x8
|
|
|
|
; CHECK-NEXT: str w[[REG]], [sp, #36]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x6
|
|
|
|
; CHECK-NEXT: str x[[REG]], [sp, #24]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x4
|
|
|
|
; CHECK-NEXT: str w[[REG]], [sp, #16]
|
|
|
|
; CHECK-NEXT: orr w[[REG:[0-9]+]], wzr, #0x2
|
|
|
|
; CHECK-NEXT: str x[[REG]], [sp]
|
|
|
|
; CHECK: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK-NEXT: mov x16, #281470681743360
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK-NEXT: movk x16, #57005, lsl #16
|
|
|
|
; CHECK-NEXT: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; CHECK-NEXT: blr x16
|
|
|
|
; FAST-LABEL: jscall_patchpoint_codegen3:
|
|
|
|
; FAST: Ltmp
|
|
|
|
; FAST: orr [[REG1:x[0-9]+]], xzr, #0x2
|
|
|
|
; FAST-NEXT: orr [[REG2:w[0-9]+]], wzr, #0x4
|
|
|
|
; FAST-NEXT: orr [[REG3:x[0-9]+]], xzr, #0x6
|
|
|
|
; FAST-NEXT: orr [[REG4:w[0-9]+]], wzr, #0x8
|
2016-06-16 09:42:25 +08:00
|
|
|
; FAST-NEXT: mov [[REG5:x[0-9]+]], #10
|
2016-05-07 00:34:59 +08:00
|
|
|
; FAST-NEXT: str [[REG1]], [sp]
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST-NEXT: str [[REG2]], [sp, #16]
|
|
|
|
; FAST-NEXT: str [[REG3]], [sp, #24]
|
|
|
|
; FAST-NEXT: str [[REG4]], [sp, #36]
|
|
|
|
; FAST-NEXT: str [[REG5]], [sp, #48]
|
|
|
|
; FAST: Ltmp
|
2016-06-16 09:42:25 +08:00
|
|
|
; FAST-NEXT: mov x16, #281470681743360
|
2016-05-14 02:00:09 +08:00
|
|
|
; FAST-NEXT: movk x16, #57005, lsl #16
|
|
|
|
; FAST-NEXT: movk x16, #48879
|
2014-07-31 12:10:43 +08:00
|
|
|
; FAST-NEXT: blr x16
|
|
|
|
%call = inttoptr i64 281474417671919 to i8*
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%result = call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 7, i32 20, i8* %call, i32 10, i64 %callee, i64 2, i64 undef, i32 4, i32 undef, i64 6, i32 undef, i32 8, i32 undef, i64 10)
|
2014-07-31 12:10:43 +08:00
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: test_i16:
|
|
|
|
; CHECK: ldrh [[BREG:w[0-9]+]], [sp]
|
|
|
|
; CHECK: add {{w[0-9]+}}, w0, [[BREG]]
|
|
|
|
define webkit_jscc zeroext i16 @test_i16(i16 zeroext %a, i16 zeroext %b) {
|
|
|
|
%sum = add i16 %a, %b
|
|
|
|
ret i16 %sum
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
|
|
|
|
declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
|