File: simplify-demanded-bits-build-pair.ll

package info (click to toggle)
llvm-toolchain-3.9 1%3A3.9.1-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 441,060 kB
  • ctags: 428,777
  • sloc: cpp: 2,546,577; ansic: 538,318; asm: 119,677; objc: 103,316; python: 102,148; sh: 27,847; pascal: 5,626; ml: 5,510; perl: 5,293; lisp: 4,801; makefile: 2,177; xml: 686; cs: 362; php: 212; csh: 117
file content (39 lines) | stat: -rw-r--r-- 1,550 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
; XFAIL: *
; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=SI -mattr=-promote-alloca < %s | FileCheck -check-prefix=SI %s
; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-promote-alloca < %s | FileCheck -check-prefix=SI %s

; 64-bit select was originally lowered with a build_pair, and this
; could be simplified to 1 cndmask instead of 2, but that broken when
; it started being implemented with a v2i32 build_vector and
; bitcasting.
define void @trunc_select_i64(i32 addrspace(1)* %out, i64 %a, i64 %b, i32 %c) {
  %cmp = icmp eq i32 %c, 0
  %select = select i1 %cmp, i64 %a, i64 %b
  %trunc = trunc i64 %select to i32
  store i32 %trunc, i32 addrspace(1)* %out, align 4
  ret void
}

; FIXME: Fix truncating store for local memory
; SI-LABEL: {{^}}trunc_load_alloca_i64:
; SI: v_movrels_b32
; SI-NOT: v_movrels_b32
; SI: s_endpgm
define void @trunc_load_alloca_i64(i64 addrspace(1)* %out, i32 %a, i32 %b) {
  %idx = add i32 %a, %b
  %alloca = alloca i64, i32 4
  %gep0 = getelementptr i64, i64* %alloca, i64 0
  %gep1 = getelementptr i64, i64* %alloca, i64 1
  %gep2 = getelementptr i64, i64* %alloca, i64 2
  %gep3 = getelementptr i64, i64* %alloca, i64 3
  store i64 24, i64* %gep0, align 8
  store i64 9334, i64* %gep1, align 8
  store i64 3935, i64* %gep2, align 8
  store i64 9342, i64* %gep3, align 8
  %gep = getelementptr i64, i64* %alloca, i32 %idx
  %load = load i64, i64* %gep, align 8
  %mask = and i64 %load, 4294967296
  %add = add i64 %mask, -1
  store i64 %add, i64 addrspace(1)* %out, align 4
  ret void
}