1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
3 # RUN: llc -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
6 name: agc.test_combine_ptradd_constants_intres
10 ; CHECK-LABEL: name: agc.test_combine_ptradd_constants_intres
11 ; CHECK: [[C:%[0-9]+]]:_(p64) = G_CONSTANT i64 44
12 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[C]](p64)
13 ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
14 %1:_(s32) = G_CONSTANT i32 42
15 %2:_(s32) = G_CONSTANT i32 2
16 %3:_(p64) = G_INTTOPTR %2
17 %4:_(p64) = G_PTR_ADD %3, %1
18 %5:_(s64) = G_PTRTOINT %4
22 name: agc.test_combine_ptradd_constants_ptrres
26 ; CHECK-LABEL: name: agc.test_combine_ptradd_constants_ptrres
27 ; CHECK: [[C:%[0-9]+]]:_(p64) = G_CONSTANT i64 44
28 ; CHECK: $x0 = COPY [[C]](p64)
29 %1:_(s32) = G_CONSTANT i32 42
30 %2:_(s32) = G_CONSTANT i32 2
31 %3:_(p64) = G_INTTOPTR %2
32 %4:_(p64) = G_PTR_ADD %3, %1
36 name: agc.test_not_combine_variable_ptradd
40 ; Ensure non-constant G_PTR_ADDs are not folded.
41 ; CHECK-LABEL: name: agc.test_not_combine_variable_ptradd
42 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 42
43 ; CHECK: [[COPY:%[0-9]+]]:_(p64) = COPY $x1
44 ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p64) = G_PTR_ADD [[COPY]], [[C]](s32)
45 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[PTR_ADD]](p64)
46 ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
47 %1:_(s32) = G_CONSTANT i32 42
49 %3:_(p64) = G_PTR_ADD %2, %1
50 %4:_(s64) = G_PTRTOINT %3
54 name: test_combine_zero_extend
59 ; CHECK-LABEL: name: test_combine_zero_extend
60 ; CHECK: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 4291891236
61 ; CHECK-NEXT: $x0 = COPY [[C]](p0)
62 %0:_(s32) = G_CONSTANT i32 -3076096
63 %1:_(p0) = G_INTTOPTR %0:_(s32)
64 %2:_(s64) = G_CONSTANT i64 36
65 %3:_(p0) = G_PTR_ADD %1:_, %2:_(s64)