1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 tracksRegLiveness: true
9 ; Fold ((0-A) + B) -> B - A
10 ; CHECK-LABEL: name: pat1
11 ; CHECK: liveins: $x0, $x1
12 ; CHECK: %copy1:_(s64) = COPY $x0
13 ; CHECK: %copy2:_(s64) = COPY $x1
14 ; CHECK: %add:_(s64) = G_SUB %copy2, %copy1
15 ; CHECK: $x0 = COPY %add(s64)
16 ; CHECK: RET_ReallyLR implicit $x0
17 %copy1:_(s64) = COPY $x0
18 %copy2:_(s64) = COPY $x1
19 %zero:_(s64) = G_CONSTANT i64 0
20 %sub:_(s64) = G_SUB %zero, %copy1
21 %add:_(s64) = G_ADD %sub, %copy2
23 RET_ReallyLR implicit $x0
28 tracksRegLiveness: true
32 ; Fold (A + (0-B)) -> A - B
33 ; CHECK-LABEL: name: pat2
34 ; CHECK: liveins: $x0, $x1
35 ; CHECK: %copy1:_(s64) = COPY $x0
36 ; CHECK: %copy2:_(s64) = COPY $x1
37 ; CHECK: %add:_(s64) = G_SUB %copy1, %copy2
38 ; CHECK: $x0 = COPY %add(s64)
39 ; CHECK: RET_ReallyLR implicit $x0
40 %copy1:_(s64) = COPY $x0
41 %copy2:_(s64) = COPY $x1
42 %zero:_(s64) = G_CONSTANT i64 0
43 %sub:_(s64) = G_SUB %zero, %copy2
44 %add:_(s64) = G_ADD %copy1, %sub
46 RET_ReallyLR implicit $x0