File: imm-range-check.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,245,044 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,666; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (26 lines) | stat: -rw-r--r-- 1,008 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
; RUN: llc -mtriple=hexagon -filetype=obj < %s | llvm-objdump -d - | FileCheck %s

; The output assembly (textual) contains the instruction
;   r29 = add(r29,#4294967136)
; The value 4294967136 is -160 when interpreted as a signed 32-bit
; integer, so it fits in the range of the immediate operand without
; a constant extender. The range check in HexagonInstrInfo was putting
; the operand value into an int variable, reporting no need for an
; extender. This resulted in a packet with 4 instructions, including
; the "add". The corresponding check in HexagonMCInstrInfo was using
; an int64_t variable, causing an extender to be emitted when lowering
; to MCInst, and resulting in a packet with 5 instructions.

; Check that this doesn't crash.
; CHECK: r29 = add(r29,#-0xa0)

target triple = "hexagon-unknown-linux-gnu"

define float @f0() {
b0:
  %v0 = alloca i8, i32 0, align 1
  %v1 = alloca float, i32 -42, align 4
  %v2 = load float, ptr %v1, align 4
  store i8 0, ptr %v0, align 1
  ret float %v2
}