File: vscale-shufflevector-inseltpoison.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (39 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; RUN: opt -early-cse -earlycse-debug-hash -S < %s | FileCheck %s

target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64"

; This test checks that SimplifyInstruction does not blow up in the face of
; a scalable shufflevector. vscale is a constant value known only at runtime.
; Therefore, it is not possible to know the concrete value of, or the length
; of the mask at compile time. Simplifications that depend on the value
; of the mask cannot be performed.

; Given the fact that the value of the mask is unknown at compile time for
; scalable vectors, very few simplifications will be done. Here, we want to
; see that the instruction can be passed to SimplifyInstruction and not crash
; the compiler. It happens to be the case that this will be the result.

; CHECK-LABEL: define <vscale x 8 x i1> @vscale_version()
; CHECK-NEXT: ret <vscale x 8 x i1> shufflevector (<vscale x 8 x i1> insertelement (<vscale x 8 x i1> poison, i1 true, i32 0), <vscale x 8 x i1> undef, <vscale x 8 x i32> zeroinitializer)

define <vscale x 8 x i1> @vscale_version() {
  %splatter = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
  %foo = shufflevector <vscale x 8 x i1> %splatter,
                       <vscale x 8 x i1> undef,
                       <vscale x 8 x i32> zeroinitializer
  ret <vscale x 8 x i1> %foo
}

; The non-scalable version should be optimized as normal.

; CHECK-LABEL: define <8 x i1> @fixed_length_version() {
; CHECK-NEXT:  ret <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>
define <8 x i1> @fixed_length_version() {
  %splatter = insertelement <8 x i1> poison, i1 true, i32 0
  %foo = shufflevector <8 x i1> %splatter,
                       <8 x i1> undef,
                       <8 x i32> zeroinitializer
  ret <8 x i1> %foo
}