mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
8b2b8a1835
This update was done with the following bash script: find test/CodeGen -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc.*debug" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP done sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186280 91177308-0d34-0410-b5e6-96231b3b80d8
153 lines
4.4 KiB
LLVM
153 lines
4.4 KiB
LLVM
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
|
|
|
|
@var32 = global i32 0
|
|
@var64 = global i64 0
|
|
|
|
define void @rev_i32() {
|
|
; CHECK-LABEL: rev_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val1_tmp = call i32 @llvm.bswap.i32(i32 %val0_tmp)
|
|
; CHECK: rev {{w[0-9]+}}, {{w[0-9]+}}
|
|
store volatile i32 %val1_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @rev_i64() {
|
|
; CHECK-LABEL: rev_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val1_tmp = call i64 @llvm.bswap.i64(i64 %val0_tmp)
|
|
; CHECK: rev {{x[0-9]+}}, {{x[0-9]+}}
|
|
store volatile i64 %val1_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
define void @rev32_i64() {
|
|
; CHECK-LABEL: rev32_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val1_tmp = shl i64 %val0_tmp, 32
|
|
%val5_tmp = sub i64 64, 32
|
|
%val2_tmp = lshr i64 %val0_tmp, %val5_tmp
|
|
%val3_tmp = or i64 %val1_tmp, %val2_tmp
|
|
%val4_tmp = call i64 @llvm.bswap.i64(i64 %val3_tmp)
|
|
; CHECK: rev32 {{x[0-9]+}}, {{x[0-9]+}}
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
define void @rev16_i32() {
|
|
; CHECK-LABEL: rev16_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val1_tmp = shl i32 %val0_tmp, 16
|
|
%val2_tmp = lshr i32 %val0_tmp, 16
|
|
%val3_tmp = or i32 %val1_tmp, %val2_tmp
|
|
%val4_tmp = call i32 @llvm.bswap.i32(i32 %val3_tmp)
|
|
; CHECK: rev16 {{w[0-9]+}}, {{w[0-9]+}}
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @clz_zerodef_i32() {
|
|
; CHECK-LABEL: clz_zerodef_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val4_tmp = call i32 @llvm.ctlz.i32(i32 %val0_tmp, i1 0)
|
|
; CHECK: clz {{w[0-9]+}}, {{w[0-9]+}}
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @clz_zerodef_i64() {
|
|
; CHECK-LABEL: clz_zerodef_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val4_tmp = call i64 @llvm.ctlz.i64(i64 %val0_tmp, i1 0)
|
|
; CHECK: clz {{x[0-9]+}}, {{x[0-9]+}}
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
define void @clz_zeroundef_i32() {
|
|
; CHECK-LABEL: clz_zeroundef_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val4_tmp = call i32 @llvm.ctlz.i32(i32 %val0_tmp, i1 1)
|
|
; CHECK: clz {{w[0-9]+}}, {{w[0-9]+}}
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @clz_zeroundef_i64() {
|
|
; CHECK-LABEL: clz_zeroundef_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val4_tmp = call i64 @llvm.ctlz.i64(i64 %val0_tmp, i1 1)
|
|
; CHECK: clz {{x[0-9]+}}, {{x[0-9]+}}
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
define void @cttz_zerodef_i32() {
|
|
; CHECK-LABEL: cttz_zerodef_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val4_tmp = call i32 @llvm.cttz.i32(i32 %val0_tmp, i1 0)
|
|
; CHECK: rbit [[REVERSED:w[0-9]+]], {{w[0-9]+}}
|
|
; CHECK: clz {{w[0-9]+}}, [[REVERSED]]
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @cttz_zerodef_i64() {
|
|
; CHECK-LABEL: cttz_zerodef_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val4_tmp = call i64 @llvm.cttz.i64(i64 %val0_tmp, i1 0)
|
|
; CHECK: rbit [[REVERSED:x[0-9]+]], {{x[0-9]+}}
|
|
; CHECK: clz {{x[0-9]+}}, [[REVERSED]]
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
define void @cttz_zeroundef_i32() {
|
|
; CHECK-LABEL: cttz_zeroundef_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val4_tmp = call i32 @llvm.cttz.i32(i32 %val0_tmp, i1 1)
|
|
; CHECK: rbit [[REVERSED:w[0-9]+]], {{w[0-9]+}}
|
|
; CHECK: clz {{w[0-9]+}}, [[REVERSED]]
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @cttz_zeroundef_i64() {
|
|
; CHECK-LABEL: cttz_zeroundef_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val4_tmp = call i64 @llvm.cttz.i64(i64 %val0_tmp, i1 1)
|
|
; CHECK: rbit [[REVERSED:x[0-9]+]], {{x[0-9]+}}
|
|
; CHECK: clz {{x[0-9]+}}, [[REVERSED]]
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
; These two are just compilation tests really: the operation's set to Expand in
|
|
; ISelLowering.
|
|
define void @ctpop_i32() {
|
|
; CHECK-LABEL: ctpop_i32:
|
|
%val0_tmp = load i32* @var32
|
|
%val4_tmp = call i32 @llvm.ctpop.i32(i32 %val0_tmp)
|
|
store volatile i32 %val4_tmp, i32* @var32
|
|
ret void
|
|
}
|
|
|
|
define void @ctpop_i64() {
|
|
; CHECK-LABEL: ctpop_i64:
|
|
%val0_tmp = load i64* @var64
|
|
%val4_tmp = call i64 @llvm.ctpop.i64(i64 %val0_tmp)
|
|
store volatile i64 %val4_tmp, i64* @var64
|
|
ret void
|
|
}
|
|
|
|
|
|
declare i32 @llvm.bswap.i32(i32)
|
|
declare i64 @llvm.bswap.i64(i64)
|
|
declare i32 @llvm.ctlz.i32 (i32, i1)
|
|
declare i64 @llvm.ctlz.i64 (i64, i1)
|
|
declare i32 @llvm.cttz.i32 (i32, i1)
|
|
declare i64 @llvm.cttz.i64 (i64, i1)
|
|
declare i32 @llvm.ctpop.i32 (i32)
|
|
declare i64 @llvm.ctpop.i64 (i64)
|
|
|