[llvm] [GlobalIsel] Combine cast of const integer. (PR #96139)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 01:45:54 PDT 2024
================
@@ -0,0 +1,45 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
+
+---
+name: zext_const
+body: |
+ bb.0:
+ liveins: $w0, $w1
+ ; CHECK-LABEL: name: zext_const
+ ; CHECK: liveins: $w0, $w1
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
+ ; CHECK-NEXT: $x0 = COPY [[C]](s64)
+ %2:_(s32) = G_CONSTANT i32 5
+ %3:_(s64) = G_ZEXT %2
+ $x0 = COPY %3
+...
+---
+name: sext_const
+body: |
+ bb.0:
+ liveins: $q0, $q1
+ ; CHECK-LABEL: name: sext_const
+ ; CHECK: liveins: $q0, $q1
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -5
+ ; CHECK-NEXT: $x0 = COPY [[C]](s64)
+ %2:_(s32) = G_CONSTANT i32 -5
+ %3:_(s64) = G_SEXT %2
+ $x0 = COPY %3
+...
+---
+name: trunc_const
+body: |
+ bb.0:
+ liveins: $q0, $q1
+ ; CHECK-LABEL: name: trunc_const
+ ; CHECK: liveins: $q0, $q1
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 705032704
+ ; CHECK-NEXT: $w0 = COPY [[C]](s32)
+ %2:_(s64) = G_CONSTANT i64 5000000000
+ %3:_(s32) = G_TRUNC %2
+ $w0 = COPY %3
+
----------------
tschuett wrote:
https://github.com/llvm/llvm-project/blob/ef16f7ac1b3267e11bad464b4116d34396e7967f/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L12890
https://github.com/llvm/llvm-project/pull/96139
More information about the llvm-commits
mailing list