File: irtranslator-one-by-n-vector-ptr-add.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (42 lines) | stat: -rw-r--r-- 2,002 bytes parent folder | download | duplicates (14)
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
40
41
42
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc -O0 -global-isel -mtriple aarch64 -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s

; Make sure we treat <1 x N> getelementptrs like scalar getelementptrs.

; We should not create a splat vector for the non-vector index on this
; getelementptr. The entire getelementptr should be translated to a scalar
; G_PTR_ADD.
define <1 x ptr> @one_elt_vector_ptr_add_non_vector_idx(<1 x ptr> %vec) {
  ; CHECK-LABEL: name: one_elt_vector_ptr_add_non_vector_idx
  ; CHECK: bb.1 (%ir-block.0):
  ; CHECK:   liveins: $d0
  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $d0
  ; CHECK:   [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
  ; CHECK:   [[COPY1:%[0-9]+]]:_(s32) = COPY [[C]](s32)
  ; CHECK:   [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
  ; CHECK:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[SEXT]](s64)
  ; CHECK:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
  ; CHECK:   $d0 = COPY [[COPY2]](p0)
  ; CHECK:   RET_ReallyLR implicit $d0
  %ptr_add = getelementptr i8, <1 x ptr> %vec, <1 x i32> <i32 1>
  ret <1 x ptr> %ptr_add
}

; We should not create a splat vector for the non-vector pointer on this
; getelementptr. The entire getelementptr should be translated to a scalar
; G_PTR_ADD.
define <1 x ptr> @one_elt_vector_ptr_add_non_vector_ptr(ptr %vec) {
  ; CHECK-LABEL: name: one_elt_vector_ptr_add_non_vector_ptr
  ; CHECK: bb.1 (%ir-block.0):
  ; CHECK:   liveins: $x0
  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; CHECK:   [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
  ; CHECK:   [[COPY1:%[0-9]+]]:_(s32) = COPY [[C]](s32)
  ; CHECK:   [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
  ; CHECK:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[SEXT]](s64)
  ; CHECK:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
  ; CHECK:   $d0 = COPY [[COPY2]](p0)
  ; CHECK:   RET_ReallyLR implicit $d0
  %ptr_add = getelementptr i8, ptr %vec, <1 x i32> <i32 1>
  ret <1 x ptr> %ptr_add
}