1 ; RUN: llc -o - %s | FileCheck %s
3 ; AsmPrinter cannot lower floating point constant expressions in global
4 ; initializers. Check that we do not create new globals with float constant
5 ; expressions in initializers.
7 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
8 target triple = "arm64-apple-ios14.0.0"
10 define [1 x <4 x float>] @test1() {
11 ; CHECK-LABEL: .p2align 4, 0x0 ; -- Begin function test1
12 ; CHECK-NEXT: lCPI0_0:
13 ; CHECK-NEXT: .quad 0 ; 0x0
14 ; CHECK-NEXT: .quad 4575657221408423936 ; 0x3f80000000000000
15 ; CHECK-NEXT: .section __TEXT,__text,regular,pure_instructions
16 ; CHECK-NEXT: .globl _test1
17 ; CHECK-NEXT: .p2align 2
18 ; CHECK-NEXT: _test1: ; @test1
19 ; CHECK-NEXT: .cfi_startproc
20 ; CHECK-NEXT: ; %bb.0:
22 ; CHECK-NEXT: adrp x8, lCPI0_0@PAGE
24 ; CHECK-NEXT: ldr q0, [x8, lCPI0_0@PAGEOFF]
27 ret [1 x <4 x float>] [<4 x float> bitcast (<1 x i128> <i128 84405977732342157929391748327801880576> to <4 x float>)]
30 define [1 x <4 x float>] @test2() {
31 ; CHECK-LABEL: .p2align 4, 0x0 ; -- Begin function test2
32 ; CHECK-NEXT: lCPI1_0:
33 ; CHECK-NEXT: .long 0x00000000 ; float 0
34 ; CHECK-NEXT: .long 0x00000000 ; float 0
35 ; CHECK-NEXT: .long 0x00000000 ; float 0
36 ; CHECK-NEXT: .long 0x3f800000 ; float 1
37 ; CHECK-NEXT: .section __TEXT,__text,regular,pure_instructions
38 ; CHECK-NEXT: .globl _test2
39 ; CHECK-NEXT: .p2align 2
40 ; CHECK-NEXT: _test2: ; @test2
41 ; CHECK-NEXT: .cfi_startproc
42 ; CHECK-NEXT: ; %bb.0:
44 ; CHECK-NEXT: adrp x8, lCPI1_0@PAGE
46 ; CHECK-NEXT: ldr q1, [x8, lCPI1_0@PAGEOFF]
47 ; CHECK-NEXT: mov s2, v1[1]
48 ; CHECK-NEXT: fneg s0, s1
49 ; CHECK-NEXT: mov s3, v1[2]
50 ; CHECK-NEXT: mov s1, v1[3]
51 ; CHECK-NEXT: fneg s2, s2
52 ; CHECK-NEXT: fneg s3, s3
53 ; CHECK-NEXT: fneg s1, s1
54 ; CHECK-NEXT: mov.s v0[1], v2[0]
55 ; CHECK-NEXT: mov.s v0[2], v3[0]
56 ; CHECK-NEXT: mov.s v0[3], v1[0]
59 %constexpr = fneg float extractelement (<4 x float> bitcast (<1 x i128> <i128 84405977732342157929391748327801880576> to <4 x float>), i32 0)
60 %constexpr1 = fneg float extractelement (<4 x float> bitcast (<1 x i128> <i128 84405977732342157929391748327801880576> to <4 x float>), i32 1)
61 %constexpr2 = fneg float extractelement (<4 x float> bitcast (<1 x i128> <i128 84405977732342157929391748327801880576> to <4 x float>), i32 2)
62 %constexpr3 = fneg float extractelement (<4 x float> bitcast (<1 x i128> <i128 84405977732342157929391748327801880576> to <4 x float>), i32 3)
63 %constexpr.ins = insertelement <4 x float> poison, float %constexpr, i32 0
64 %constexpr.ins4 = insertelement <4 x float> %constexpr.ins, float %constexpr1, i32 1
65 %constexpr.ins5 = insertelement <4 x float> %constexpr.ins4, float %constexpr2, i32 2
66 %constexpr.ins6 = insertelement <4 x float> %constexpr.ins5, float %constexpr3, i32 3
67 %constexpr.ins7 = insertvalue [1 x <4 x float>] poison, <4 x float> %constexpr.ins6, 0
68 ret [1 x <4 x float>] %constexpr.ins7