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