Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-narrow-binop-feeding-add.mir
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

344 lines
12 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
...
---
name: add_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: add_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(i32) = G_ADD [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ADD]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: sub_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: sub_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[SUB:%[0-9]+]]:_(i32) = G_SUB [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[SUB]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_SUB %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: mul_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: mul_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(i32) = G_MUL [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[MUL]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_MUL %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: and_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: and_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[AND:%[0-9]+]]:_(i32) = G_AND [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[AND]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_AND %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: or_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: or_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %mask_32:_(s64) = G_CONSTANT i64 4294967295
; CHECK-NEXT: %binop:_(s64) = G_SUB %binop_lhs, %binop_rhs
; CHECK-NEXT: %and:_(s64) = G_OR %binop, %mask_32
; CHECK-NEXT: $x0 = COPY %and(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_SUB %binop_lhs, %binop_rhs
%and:_(s64) = G_OR %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: xor_64_mask_32
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: xor_64_mask_32
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[XOR:%[0-9]+]]:_(i32) = G_XOR [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[XOR]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_XOR %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: walk_thru_copy
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: walk_thru_copy
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(i32) = G_TRUNC %binop_lhs(s64)
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(i32) = G_TRUNC %binop_rhs(s64)
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(i32) = G_ADD [[TRUNC]], [[TRUNC1]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ADD]](i32)
; CHECK-NEXT: $x0 = COPY [[ZEXT]](s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%copy:_(s64) = COPY %binop
%and:_(s64) = G_AND %copy, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_zext_not_free_add_64_mask_16
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_zext_not_free_add_64_mask_16
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %mask_16:_(s64) = G_CONSTANT i64 65535
; CHECK-NEXT: %binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: %and:_(s64) = G_AND %binop, %mask_16
; CHECK-NEXT: $x0 = COPY %and(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_16:_(s64) = G_CONSTANT i64 65535
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_16
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_zext_not_free_add_64_mask_8
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_zext_not_free_add_64_mask_8
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %mask_8:_(s64) = G_CONSTANT i64 255
; CHECK-NEXT: %binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: %and:_(s64) = G_AND %binop, %mask_8
; CHECK-NEXT: $x0 = COPY %and(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_8:_(s64) = G_CONSTANT i64 255
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_8
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_not_a_mask
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_not_a_mask
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %not_a_mask:_(s64) = G_CONSTANT i64 26
; CHECK-NEXT: %binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: %and:_(s64) = G_AND %binop, %not_a_mask
; CHECK-NEXT: $x0 = COPY %and(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%not_a_mask:_(s64) = G_CONSTANT i64 26
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %not_a_mask
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_more_than_one_use
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_more_than_one_use
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: $x0 = COPY %binop(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%not_a_mask:_(s64) = G_CONSTANT i64 26
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %not_a_mask
%or:_(s64) = G_OR %and, %binop
$x0 = COPY %or(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_vector
tracksRegLiveness: true
body: |
bb.0:
liveins: $q0, $q1
; CHECK-LABEL: name: dont_combine_vector
; CHECK: liveins: $q0, $q1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(<2 x s64>) = COPY $q0
; CHECK-NEXT: %binop_rhs:_(<2 x s64>) = COPY $q1
; CHECK-NEXT: %mask_elt:_(s64) = G_CONSTANT i64 4294967295
; CHECK-NEXT: %mask:_(<2 x s64>) = G_BUILD_VECTOR %mask_elt(s64), %mask_elt(s64)
; CHECK-NEXT: %binop:_(<2 x s64>) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: %and:_(<2 x s64>) = G_AND %binop, %mask
; CHECK-NEXT: $q0 = COPY %and(<2 x s64>)
; CHECK-NEXT: RET_ReallyLR implicit $q0
%binop_lhs:_(<2 x s64>) = COPY $q0
%binop_rhs:_(<2 x s64>) = COPY $q1
%mask_elt:_(s64) = G_CONSTANT i64 4294967295
%mask:_(<2 x s64>) = G_BUILD_VECTOR %mask_elt, %mask_elt
%binop:_(<2 x s64>) = G_ADD %binop_lhs, %binop_rhs
%and:_(<2 x s64>) = G_AND %binop, %mask
$q0 = COPY %and(<2 x s64>)
RET_ReallyLR implicit $q0
...
---
name: dont_combine_add_64_mask_64
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_add_64_mask_64
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %binop_lhs:_(s64) = COPY $x0
; CHECK-NEXT: %binop_rhs:_(s64) = COPY $x1
; CHECK-NEXT: %binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
; CHECK-NEXT: $x0 = COPY %binop(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%binop_lhs:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_64:_(s64) = G_CONSTANT i64 18446744073709551615
%binop:_(s64) = G_ADD %binop_lhs, %binop_rhs
%and:_(s64) = G_AND %binop, %mask_64
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0
...
---
name: dont_combine_copy_from_physreg
tracksRegLiveness: true
body: |
bb.0:
liveins: $x0, $x1
; CHECK-LABEL: name: dont_combine_copy_from_physreg
; CHECK: liveins: $x0, $x1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: %copy_from_physreg:_(s64) = COPY $x0
; CHECK-NEXT: %mask_32:_(s64) = G_CONSTANT i64 4294967295
; CHECK-NEXT: %and:_(s64) = G_AND %copy_from_physreg, %mask_32
; CHECK-NEXT: $x0 = COPY %and(s64)
; CHECK-NEXT: RET_ReallyLR implicit $x0
%copy_from_physreg:_(s64) = COPY $x0
%binop_rhs:_(s64) = COPY $x1
%mask_32:_(s64) = G_CONSTANT i64 4294967295
%copy:_(s64) = COPY %copy_from_physreg
%and:_(s64) = G_AND %copy, %mask_32
$x0 = COPY %and(s64)
RET_ReallyLR implicit $x0