Files
clang-p2996/llvm/test/CodeGen/NVPTX/libcall-fulfilled.ll
Andrew Savonichev 0f1b5f115a [NVPTX] Integrate ptxas to LIT tests
ptxas is a proprietary compiler from Nvidia that can compile PTX to
machine code (SASS). It has a lot of diagnostics to catch errors
in PTX, which can be used to verify PTX output from llc.

Set -DPXTAS_EXECUTABLE=/path/to/ptxas CMake option to enable it.
If this option is not set, then ptxas is substituted to true which
effectively disables all ptxas RUN lines.

LLVM_PTXAS_EXECUTABLE environment variable takes precedence over
the CMake option, and allows to override ptxas executable that is used for LIT
without complete re-configuration.

Differential Revision: https://reviews.llvm.org/D121727
2022-04-28 14:59:45 +03:00

48 lines
1.2 KiB
LLVM

; RUN: llc < %s -march=nvptx 2>&1 | FileCheck %s
; RUN: %if ptxas %{ llc < %s -march=nvptx | %ptxas-verify %}
; Allow to make libcalls that are defined in the current module
declare i8* @malloc(i64)
declare void @free(i8*)
; Underlying libcall declaration
; CHECK: .visible .func (.param .align 16 .b8 func_retval0[16]) __umodti3
define i128 @remainder(i128, i128) {
bb0:
; CHECK: { // callseq 0, 0
; CHECK: call.uni (retval0),
; CHECK-NEXT: __umodti3,
; CHECK-NEXT: (
; CHECK-NEXT: param0,
; CHECK-NEXT: param1
; CHECK-NEXT: );
; CHECK-NEXT: ld.param.v2.b64 {%[[REG0:rd[0-9]+]], %[[REG1:rd[0-9]+]]}, [retval0+0];
; CHECK-NEXT: } // callseq 0
%a = urem i128 %0, %1
br label %bb1
bb1:
; CHECK-NEXT: st.param.v2.b64 [func_retval0+0], {%[[REG0]], %[[REG1]]};
; CHECK-NEXT: ret;
ret i128 %a
}
; Underlying libcall definition
; CHECK: .visible .func (.param .align 16 .b8 func_retval0[16]) __umodti3(
define i128 @__umodti3(i128, i128) {
ret i128 0
}
define void @malloc_then_free() {
; CHECK: call.uni (retval0),
; CHECK: malloc,
; CHECK: call.uni
; CHECK: free,
%a = call i8* @malloc(i64 4)
store i8 0, i8* %a
call void @free(i8* %a)
ret void
}