| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: llc -mtriple=aarch64 < %s | FileCheck %s --check-prefix=AARCH64 | |
| ; bitextract | |
| define i1 @test_bitextract_b8_off0(b8 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b8_off0: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: and w0, w0, #0x1 | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i1, b8 %src, i32 0 | |
| ret i1 %result | |
| } | |
| define i4 @test_bitextract_b8_nibble_hi(b8 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b8_nibble_hi: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: ubfx w0, w0, #4, #4 | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i4, b8 %src, i32 4 | |
| ret i4 %result | |
| } | |
| define i1 @test_bitextract_b8_off_top(b8 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b8_off_top: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: ubfx w0, w0, #7, #1 | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i1, b8 %src, i32 7 | |
| ret i1 %result | |
| } | |
| define i8 @test_bitextract_b16_byte_hi(b16 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b16_byte_hi: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: ubfx w0, w0, #8, #8 | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i8, b16 %src, i32 8 | |
| ret i8 %result | |
| } | |
| define i32 @test_bitextract_b64_dword_hi(b64 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b64_dword_hi: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: lsr x0, x0, #32 | |
| ; AARCH64-NEXT: // kill: def $w0 killed $w0 killed $x0 | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i32, b64 %src, i32 32 | |
| ret i32 %result | |
| } | |
| define i64 @test_bitextract_b128_lo64(b128 %src) { | |
| ; AARCH64-LABEL: test_bitextract_b128_lo64: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: ret | |
| %result = bitextract i64, b128 %src, i32 0 | |
| ret i64 %result | |
| } | |
| define b8 @test_bitinsert_b8_off1(b8 %base, i1 %val) { | |
| ; AARCH64-LABEL: test_bitinsert_b8_off1: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: and w8, w0, #0xfffffffd | |
| ; AARCH64-NEXT: orr w0, w8, w1, lsl #1 | |
| ; AARCH64-NEXT: ret | |
| %result = bitinsert b8 %base, i1 %val, i32 1 | |
| ret b8 %result | |
| } | |
| define b16 @test_bitinsert_b16_off8(b16 %base, i8 %val) { | |
| ; AARCH64-LABEL: test_bitinsert_b16_off8: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: bfi w0, w1, #8, #24 | |
| ; AARCH64-NEXT: ret | |
| %result = bitinsert b16 %base, i8 %val, i32 8 | |
| ret b16 %result | |
| } | |
| ; b32 container: offsets 1, 2, 4, 8, 16 | |
| define b32 @test_bitinsert_b32_off8(b32 %base, i8 %val) { | |
| ; AARCH64-LABEL: test_bitinsert_b32_off8: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: bfi w0, w1, #8, #8 | |
| ; AARCH64-NEXT: ret | |
| %result = bitinsert b32 %base, i8 %val, i32 8 | |
| ret b32 %result | |
| } | |
| define b64 @test_bitinsert_b64_off32(b64 %base, i32 %val) { | |
| ; AARCH64-LABEL: test_bitinsert_b64_off32: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: // kill: def $w1 killed $w1 def $x1 | |
| ; AARCH64-NEXT: bfi x0, x1, #32, #32 | |
| ; AARCH64-NEXT: ret | |
| %result = bitinsert b64 %base, i32 %val, i32 32 | |
| ret b64 %result | |
| } | |
| ; b128 container: offsets 1, 2, 4, 8, 16, 32, 64 | |
| define b128 @test_bitinsert_b128_off64(b128 %base, i64 %val) { | |
| ; AARCH64-LABEL: test_bitinsert_b128_off64: | |
| ; AARCH64: // %bb.0: | |
| ; AARCH64-NEXT: mov x1, x2 | |
| ; AARCH64-NEXT: ret | |
| %result = bitinsert b128 %base, i64 %val, i32 64 | |
| ret b128 %result | |
| } |