[llvm] [CodeGen] Add preliminary plumbing for `samesign` flag (PR #112354)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 14:36:52 PDT 2024
================
@@ -0,0 +1,38 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -march=x86-64 -run-pass none -verify-machineinstrs -o - %s | FileCheck %s
+
+--- |
+
+ define i1 @icmp_samesign(i32 %a, i32 %b) {
+ entry:
+ %res = icmp samesign ult i32 %a, %b
+ ret i1 %res
+ }
+
+...
+---
+name: icmp_samesign
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: gr32 }
+ - { id: 1, class: gr32 }
+liveins:
+ - { reg: '$edi', virtual-reg: '%0' }
+ - { reg: '$esi', virtual-reg: '%1' }
+body: |
+ bb.0.entry:
+ liveins: $edi, $esi
+ ; CHECK-LABEL: name: icmp_samesign
+ ; CHECK: liveins: $edi, $esi
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $esi
+ ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $edi
+ ; CHECK-NEXT: samesign CMP32rr killed [[COPY1]], killed [[COPY]], implicit-def $eflags
+ ; CHECK-NEXT: $al = SETCCr 2, implicit killed $eflags
+ ; CHECK-NEXT: RET 0, $al
+ %1 = COPY $esi
+ %0 = COPY $edi
+ samesign CMP32rr killed %0, killed %1, implicit-def $eflags
+ $al = SETCCr 2, implicit killed $eflags
----------------
arsenm wrote:
Would be more sensible to have this on a G_MIR instruction as a sample
https://github.com/llvm/llvm-project/pull/112354
More information about the llvm-commits
mailing list