File: phi-spvintrinsic-dominate.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (39 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download | duplicates (5)
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
; The goal of the test is to check that newly inserted internal (spv)
; intrinsic functions for PHI's operands are inserted at the correct
; positions, and don't break rules of instruction domination and PHI nodes
; grouping at top of basic block.

; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}

; CHECK: OpFunction
; CHECK: OpBranch
; CHECK: OpLabel
; CHECK: OpPhi
; CHECK: OpPhi
; CHECK: OpPhi

define spir_kernel void @foo(ptr addrspace(1) %_arg1) {
entry:
  br label %l1

l1:
  %sw = phi <4 x double> [ %vec, %l2 ], [ <double 0.0, double 0.0, double 0.0, double poison>, %entry ]
  %in = phi <3 x double> [ %ins, %l2 ], [ zeroinitializer, %entry ]
  %r1 = phi i32 [ %r2, %l2 ], [ 0, %entry ]
  %c1 = icmp ult i32 %r1, 3
  br i1 %c1, label %l2, label %exit

l2:
  %r3 = zext nneg i32 %r1 to i64
  %r4 = getelementptr inbounds double, ptr addrspace(1) %_arg1, i64 %r3
  %r5 = load double, ptr addrspace(1) %r4, align 8
  %ins = insertelement <3 x double> %in, double %r5, i32 %r1
  %exp = shufflevector <3 x double> %ins, <3 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison>
  %vec = shufflevector <4 x double> %exp, <4 x double> %sw, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
  %r2 = add nuw nsw i32 %r1, 1
  br label %l1

exit:
  ret void
}