Han-Kuan Chen d41e517748
[SLP] Make getSameOpcode support interchangeable instructions. (#135797)
We use the term "interchangeable instructions" to refer to different
operators that have the same meaning (e.g., `add x, 0` is equivalent to
`mul x, 1`).
Non-constant values are not supported, as they may incur high costs with
little benefit.

---------

Co-authored-by: Alexey Bataev <a.bataev@gmx.com>
2025-04-16 00:08:59 +08:00

20 lines
610 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=slp-vectorizer -S %s | FileCheck %s
define i128 @f_768_3162(i16 %0) {
; CHECK-LABEL: @f_768_3162(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[SHL22:%.*]] = shl i16 0, -1
; CHECK-NEXT: [[MUL23:%.*]] = mul i16 0, [[TMP0:%.*]]
; CHECK-NEXT: [[MUL24:%.*]] = mul i16 [[SHL22]], [[MUL23]]
; CHECK-NEXT: store i16 [[MUL24]], ptr null, align 1
; CHECK-NEXT: ret i128 0
;
entry:
%shl22 = shl i16 0, -1
%mul23 = mul i16 0, %0
%mul24 = mul i16 %shl22, %mul23
store i16 %mul24, ptr null, align 1
ret i128 0
}