1 ; RUN: llc -march=arm64 -mattr=+crc -o - %s | FileCheck %s 2 3 define i32 @test_crc32b(i32 %cur, i8 %next) { 4 ; CHECK-LABEL: test_crc32b: 5 ; CHECK: crc32b w0, w0, w1 6 %bits = zext i8 %next to i32 7 %val = call i32 @llvm.aarch64.crc32b(i32 %cur, i32 %bits) 8 ret i32 %val 9 } 10 11 define i32 @test_crc32h(i32 %cur, i16 %next) { 12 ; CHECK-LABEL: test_crc32h: 13 ; CHECK: crc32h w0, w0, w1 14 %bits = zext i16 %next to i32 15 %val = call i32 @llvm.aarch64.crc32h(i32 %cur, i32 %bits) 16 ret i32 %val 17 } 18 19 define i32 @test_crc32w(i32 %cur, i32 %next) { 20 ; CHECK-LABEL: test_crc32w: 21 ; CHECK: crc32w w0, w0, w1 22 %val = call i32 @llvm.aarch64.crc32w(i32 %cur, i32 %next) 23 ret i32 %val 24 } 25 26 define i32 @test_crc32x(i32 %cur, i64 %next) { 27 ; CHECK-LABEL: test_crc32x: 28 ; CHECK: crc32x w0, w0, x1 29 %val = call i32 @llvm.aarch64.crc32x(i32 %cur, i64 %next) 30 ret i32 %val 31 } 32 33 define i32 @test_crc32cb(i32 %cur, i8 %next) { 34 ; CHECK-LABEL: test_crc32cb: 35 ; CHECK: crc32cb w0, w0, w1 36 %bits = zext i8 %next to i32 37 %val = call i32 @llvm.aarch64.crc32cb(i32 %cur, i32 %bits) 38 ret i32 %val 39 } 40 41 define i32 @test_crc32ch(i32 %cur, i16 %next) { 42 ; CHECK-LABEL: test_crc32ch: 43 ; CHECK: crc32ch w0, w0, w1 44 %bits = zext i16 %next to i32 45 %val = call i32 @llvm.aarch64.crc32ch(i32 %cur, i32 %bits) 46 ret i32 %val 47 } 48 49 define i32 @test_crc32cw(i32 %cur, i32 %next) { 50 ; CHECK-LABEL: test_crc32cw: 51 ; CHECK: crc32cw w0, w0, w1 52 %val = call i32 @llvm.aarch64.crc32cw(i32 %cur, i32 %next) 53 ret i32 %val 54 } 55 56 define i32 @test_crc32cx(i32 %cur, i64 %next) { 57 ; CHECK-LABEL: test_crc32cx: 58 ; CHECK: crc32cx w0, w0, x1 59 %val = call i32 @llvm.aarch64.crc32cx(i32 %cur, i64 %next) 60 ret i32 %val 61 } 62 63 declare i32 @llvm.aarch64.crc32b(i32, i32) 64 declare i32 @llvm.aarch64.crc32h(i32, i32) 65 declare i32 @llvm.aarch64.crc32w(i32, i32) 66 declare i32 @llvm.aarch64.crc32x(i32, i64) 67 68 declare i32 @llvm.aarch64.crc32cb(i32, i32) 69 declare i32 @llvm.aarch64.crc32ch(i32, i32) 70 declare i32 @llvm.aarch64.crc32cw(i32, i32) 71 declare i32 @llvm.aarch64.crc32cx(i32, i64) 72