aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/VectorCombine/binop-scalarize.ll
blob: 52a706a0b59a7e59a81f56f4b37c911ce9d81877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -S -p vector-combine | FileCheck %s

; FIXME: The way we scalarize this today is by creating a
;
; %v = udiv <4 x i8> splat (i8 1), <i8 0, i8 1, i8 1, i8 1>
;
; to insert the scalar into, which is immediate UB.  Coincidentally, at creation
; this gets constant folded into <i8 poison, i8 1, i8 1, i8 1>, but we shouldn't
; rely on this.
define <4 x i8> @udiv_ub(i8 %x, i8 %y) {
; CHECK-LABEL: define <4 x i8> @udiv_ub(
; CHECK-SAME: i8 [[X:%.*]], i8 [[Y:%.*]]) {
; CHECK-NEXT:    [[V_SCALAR:%.*]] = udiv i8 [[X]], [[Y]]
; CHECK-NEXT:    [[V:%.*]] = insertelement <4 x i8> <i8 poison, i8 1, i8 1, i8 1>, i8 [[V_SCALAR]], i64 0
; CHECK-NEXT:    ret <4 x i8> [[V]]
;
  %x.insert = insertelement <4 x i8> splat (i8 1), i8 %x, i32 0
  %y.insert = insertelement <4 x i8> <i8 0, i8 1, i8 1, i8 1>, i8 %y, i32 0
  %v = udiv <4 x i8> %x.insert, %y.insert
  ret <4 x i8> %v
}