100 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s3 4name: or_same5tracksRegLiveness: true6body: |7 bb.0:8 liveins: $x09 10 ; Fold: x or x -> x11 ; CHECK-LABEL: name: or_same12 ; CHECK: liveins: $x013 ; CHECK: %copy:_(s64) = COPY $x014 ; CHECK: $x0 = COPY %copy(s64)15 ; CHECK: RET_ReallyLR implicit $x016 %copy:_(s64) = COPY $x017 %or:_(s64) = G_OR %copy, %copy18 $x0 = COPY %or(s64)19 RET_ReallyLR implicit $x020 21...22---23name: and_same24tracksRegLiveness: true25body: |26 bb.0:27 liveins: $x028 29 ; Fold: x and x -> x30 31 ; CHECK-LABEL: name: and_same32 ; CHECK: liveins: $x033 ; CHECK-NEXT: {{ $}}34 ; CHECK-NEXT: %copy:_(s64) = COPY $x035 ; CHECK-NEXT: $x0 = COPY %copy(s64)36 ; CHECK-NEXT: RET_ReallyLR implicit $x037 %copy:_(s64) = COPY $x038 %and:_(s64) = G_AND %copy, %copy39 $x0 = COPY %and(s64)40 RET_ReallyLR implicit $x041 42...43---44name: and_same245tracksRegLiveness: true46body: |47 bb.0:48 liveins: $x0, $x149 50 ; We can fold when the LHS and RHS are guaranteed to be identical.51 52 ; CHECK-LABEL: name: and_same253 ; CHECK: liveins: $x0, $x154 ; CHECK-NEXT: {{ $}}55 ; CHECK-NEXT: %copy1:_(s64) = COPY $x056 ; CHECK-NEXT: %copy2:_(s64) = COPY $x157 ; CHECK-NEXT: %or:_(s64) = G_OR %copy1, %copy258 ; CHECK-NEXT: $x0 = COPY %or(s64)59 ; CHECK-NEXT: RET_ReallyLR implicit $x060 %copy1:_(s64) = COPY $x061 %copy2:_(s64) = COPY $x162 %or:_(s64) = G_OR %copy1, %copy263 %same_as_or:_(s64) = COPY %or(s64)64 %and:_(s64) = G_AND %or, %same_as_or65 $x0 = COPY %and(s64)66 RET_ReallyLR implicit $x067 68...69---70name: or_and_not_same71tracksRegLiveness: true72body: |73 bb.0:74 liveins: $x0, $x1, $x275 76 ; None of the G_ORs or G_ANDs should be eliminated here, because their LHS77 ; and RHS values are different.78 79 ; CHECK-LABEL: name: or_and_not_same80 ; CHECK: liveins: $x0, $x1, $x281 ; CHECK-NEXT: {{ $}}82 ; CHECK-NEXT: %copy1:_(s64) = COPY $x083 ; CHECK-NEXT: %copy2:_(s64) = COPY $x184 ; CHECK-NEXT: %copy3:_(s64) = COPY $x285 ; CHECK-NEXT: %or1:_(s64) = G_OR %copy1, %copy286 ; CHECK-NEXT: %or2:_(s64) = G_OR %copy1, %copy387 ; CHECK-NEXT: %and:_(s64) = G_AND %or1, %or288 ; CHECK-NEXT: $x0 = COPY %and(s64)89 ; CHECK-NEXT: RET_ReallyLR implicit $x090 %copy1:_(s64) = COPY $x091 %copy2:_(s64) = COPY $x192 %copy3:_(s64) = COPY $x293 %or1:_(s64) = G_OR %copy1, %copy294 %or2:_(s64) = G_OR %copy1, %copy395 %and:_(s64) = G_AND %or1, %or296 $x0 = COPY %and(s64)97 RET_ReallyLR implicit $x098 99...100