llvm.org GIT mirror llvm / fb61af3
Revert "[COFF, ARM64] Implement Intrinsic.sponentry for AArch64" This reverts commit 585b6667b4712e3c7f32401e929855b3313b4ff2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345863 91177308-0d34-0410-b5e6-96231b3b80d8 Mandeep Singh Grang 1 year, 18 days ago
10 changed file(s) with 30 addition(s) and 191 deletion(s). Raw diff Collapse all Expand all
29252925 hexadecimal notation (see below). The assembler requires the exact
29262926 decimal value of a floating-point constant. For example, the
29272927 assembler accepts 1.25 but rejects 1.3 because 1.3 is a repeating
2928 decimal in binary. Floating-point constants must have a
2928 decimal in binary. Floating-point constants must have a
29292929 :ref:`floating-point ` type.
29302930 **Null pointer constants**
29312931 The identifier '``null``' is recognized as a null pointer constant
33303330 value won't fit in the integer type, the result is a
33313331 :ref:`poison value `.
33323332 ``uitofp (CST to TYPE)``
3333 Convert an unsigned integer constant to the corresponding
3333 Convert an unsigned integer constant to the corresponding
33343334 floating-point constant. TYPE must be a scalar or vector floating-point
33353335 type. CST must be of scalar or vector integer type. Both CST and TYPE must
33363336 be scalars, or vectors of the same number of elements.
54335433 '``invariant.group``' Metadata
54345434 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54355435
5436 The experimental ``invariant.group`` metadata may be attached to
5436 The experimental ``invariant.group`` metadata may be attached to
54375437 ``load``/``store`` instructions referencing a single metadata with no entries.
54385438 The existence of the ``invariant.group`` metadata on the instruction tells
54395439 the optimizer that every ``load`` and ``store`` to the same pointer operand
68746874 """"""""""
68756875
68766876 The two arguments to the '``fadd``' instruction must be
6877 :ref:`floating-point ` or :ref:`vector ` of
6877 :ref:`floating-point ` or :ref:`vector ` of
68786878 floating-point values. Both arguments must have identical types.
68796879
68806880 Semantics:
68826882
68836883 The value produced is the floating-point sum of the two operands.
68846884 This instruction is assumed to execute in the default :ref:`floating-point
6885 environment `.
6885 environment `.
68866886 This instruction can also take any number of :ref:`fast-math
68876887 flags `, which are optimization hints to enable otherwise
68886888 unsafe floating-point optimizations:
69716971 """"""""""
69726972
69736973 The two arguments to the '``fsub``' instruction must be
6974 :ref:`floating-point ` or :ref:`vector ` of
6974 :ref:`floating-point ` or :ref:`vector ` of
69756975 floating-point values. Both arguments must have identical types.
69766976
69776977 Semantics:
69796979
69806980 The value produced is the floating-point difference of the two operands.
69816981 This instruction is assumed to execute in the default :ref:`floating-point
6982 environment `.
6982 environment `.
69836983 This instruction can also take any number of :ref:`fast-math
69846984 flags `, which are optimization hints to enable otherwise
69856985 unsafe floating-point optimizations:
70667066 """"""""""
70677067
70687068 The two arguments to the '``fmul``' instruction must be
7069 :ref:`floating-point ` or :ref:`vector ` of
7069 :ref:`floating-point ` or :ref:`vector ` of
70707070 floating-point values. Both arguments must have identical types.
70717071
70727072 Semantics:
70747074
70757075 The value produced is the floating-point product of the two operands.
70767076 This instruction is assumed to execute in the default :ref:`floating-point
7077 environment `.
7077 environment `.
70787078 This instruction can also take any number of :ref:`fast-math
70797079 flags `, which are optimization hints to enable otherwise
70807080 unsafe floating-point optimizations:
72007200 """"""""""
72017201
72027202 The two arguments to the '``fdiv``' instruction must be
7203 :ref:`floating-point ` or :ref:`vector ` of
7203 :ref:`floating-point ` or :ref:`vector ` of
72047204 floating-point values. Both arguments must have identical types.
72057205
72067206 Semantics:
72087208
72097209 The value produced is the floating-point quotient of the two operands.
72107210 This instruction is assumed to execute in the default :ref:`floating-point
7211 environment `.
7211 environment `.
72127212 This instruction can also take any number of :ref:`fast-math
72137213 flags `, which are optimization hints to enable otherwise
72147214 unsafe floating-point optimizations:
73437343 """"""""""
73447344
73457345 The two arguments to the '``frem``' instruction must be
7346 :ref:`floating-point ` or :ref:`vector ` of
7346 :ref:`floating-point ` or :ref:`vector ` of
73477347 floating-point values. Both arguments must have identical types.
73487348
73497349 Semantics:
73517351
73527352 The value produced is the floating-point remainder of the two operands.
73537353 This is the same output as a libm '``fmod``' function, but without any
7354 possibility of setting ``errno``. The remainder has the same sign as the
7354 possibility of setting ``errno``. The remainder has the same sign as the
73557355 dividend.
73567356 This instruction is assumed to execute in the default :ref:`floating-point
7357 environment `.
7357 environment `.
73587358 This instruction can also take any number of :ref:`fast-math
73597359 flags `, which are optimization hints to enable otherwise
73607360 unsafe floating-point optimizations:
88088808
88098809 The '``fptrunc``' instruction casts a ``value`` from a larger
88108810 :ref:`floating-point ` type to a smaller :ref:`floating-point
8811 ` type.
8811 ` type.
88128812 This instruction is assumed to execute in the default :ref:`floating-point
88138813 environment `.
88148814
1032910329
1033010330 This intrinsic is only implemented for x86.
1033110331
10332 '``llvm.sponentry``' Intrinsic
10333 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10334
10335 Syntax:
10336 """""""
10337
10338 ::
10339
10340 declare i8* @llvm.sponentry()
10341
10342 Overview:
10343 """""""""
10344
10345 The '``llvm.sponentry``' intrinsic returns the stack pointer value at
10346 the entry of the current function calling this intrinsic.
10347
10348 Semantics:
10349 """"""""""
10350
10351 Note this intrinsic is only verified on AArch64.
10352
1035310332 '``llvm.frameaddress``' Intrinsic
1035410333 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1035510334
1213512114
1213612115 The '``llvm.fshl``' family of intrinsic functions performs a funnel shift left:
1213712116 the first two values are concatenated as { %a : %b } (%a is the most significant
12138 bits of the wide value), the combined value is shifted left, and the most
12139 significant bits are extracted to produce a result that is the same size as the
12140 original arguments. If the first 2 arguments are identical, this is equivalent
12141 to a rotate left operation. For vector types, the operation occurs for each
12142 element of the vector. The shift argument is treated as an unsigned amount
12117 bits of the wide value), the combined value is shifted left, and the most
12118 significant bits are extracted to produce a result that is the same size as the
12119 original arguments. If the first 2 arguments are identical, this is equivalent
12120 to a rotate left operation. For vector types, the operation occurs for each
12121 element of the vector. The shift argument is treated as an unsigned amount
1214312122 modulo the element size of the arguments.
1214412123
1214512124 Arguments:
1218112160
1218212161 The '``llvm.fshr``' family of intrinsic functions performs a funnel shift right:
1218312162 the first two values are concatenated as { %a : %b } (%a is the most significant
12184 bits of the wide value), the combined value is shifted right, and the least
12185 significant bits are extracted to produce a result that is the same size as the
12186 original arguments. If the first 2 arguments are identical, this is equivalent
12187 to a rotate right operation. For vector types, the operation occurs for each
12188 element of the vector. The shift argument is treated as an unsigned amount
12163 bits of the wide value), the combined value is shifted right, and the least
12164 significant bits are extracted to produce a result that is the same size as the
12165 original arguments. If the first 2 arguments are identical, this is equivalent
12166 to a rotate right operation. For vector types, the operation occurs for each
12167 element of the vector. The shift argument is treated as an unsigned amount
1218912168 modulo the element size of the arguments.
1219012169
1219112170 Arguments:
1346613445 %Tmp = call <8 x double> @llvm.masked.expandload.v8f64(double* %Bptr, <8 x i1> %Mask, <8 x double> undef)
1346713446 ; Store the result in A
1346813447 call void @llvm.masked.store.v8f64.p0v8f64(<8 x double> %Tmp, <8 x double>* %Aptr, i32 8, <8 x i1> %Mask)
13469
13448
1347013449 ; %Bptr should be increased on each iteration according to the number of '1' elements in the Mask.
1347113450 %MaskI = bitcast <8 x i1> %Mask to i8
1347213451 %MaskIPopcnt = call i8 @llvm.ctpop.i8(i8 %MaskI)
1352313502 %Tmp = call <8 x double> @llvm.masked.load.v8f64.p0v8f64(<8 x double>* %Aptr, i32 8, <8 x i1> %Mask, <8 x double> undef)
1352413503 ; Store all selected elements consecutively in array B
1352513504 call @llvm.masked.compressstore.v8f64(<8 x double> %Tmp, double* %Bptr, <8 x i1> %Mask)
13526
13505
1352713506 ; %Bptr should be increased on each iteration according to the number of '1' elements in the Mask.
1352813507 %MaskI = bitcast <8 x i1> %Mask to i8
1352913508 %MaskIPopcnt = call i8 @llvm.ctpop.i8(i8 %MaskI)
1415614135
1415714136 The '``llvm.experimental.constrained.powi``' intrinsic returns the first operand
1415814137 raised to the (positive or negative) power specified by the second operand. The
14159 order of evaluation of multiplications is not defined. When a vector of
14138 order of evaluation of multiplications is not defined. When a vector of
1416014139 floating-point type is used, the second argument remains a scalar integer value.
1416114140
1416214141
1448214461 """""""""
1448314462
1448414463 The '``llvm.experimental.constrained.nearbyint``' intrinsic returns the first
14485 operand rounded to the nearest integer. It will not raise an inexact
14464 operand rounded to the nearest integer. It will not raise an inexact
1448614465 floating-point exception if the operand is not an integer.
1448714466
1448814467
6969 /// of the frame or return address to return. An index of zero corresponds
7070 /// to the current function's frame or return address, an index of one to
7171 /// the parent's frame or return address, and so on.
72 FRAMEADDR, RETURNADDR, ADDROFRETURNADDR, SPONENTRY,
72 FRAMEADDR, RETURNADDR, ADDROFRETURNADDR,
7373
7474 /// LOCAL_RECOVER - Represents the llvm.localrecover intrinsic.
7575 /// Materializes the offset from the local object pointer of another
319319 def int_returnaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem]>;
320320 def int_addressofreturnaddress : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
321321 def int_frameaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem]>;
322 def int_sponentry : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
323322 def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty],
324323 [IntrReadMem], "llvm.read_register">;
325324 def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty],
10581058 case ISD::FRAMEADDR:
10591059 case ISD::RETURNADDR:
10601060 case ISD::ADDROFRETURNADDR:
1061 case ISD::SPONENTRY:
10621061 // These operations lie about being legal: when they claim to be legal,
10631062 // they should actually be custom-lowered.
10641063 Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0));
50475047 return nullptr;
50485048 case Intrinsic::addressofreturnaddress:
50495049 setValue(&I, DAG.getNode(ISD::ADDROFRETURNADDR, sdl,
5050 TLI.getPointerTy(DAG.getDataLayout())));
5051 return nullptr;
5052 case Intrinsic::sponentry:
5053 setValue(&I, DAG.getNode(ISD::SPONENTRY, sdl,
50545050 TLI.getPointerTy(DAG.getDataLayout())));
50555051 return nullptr;
50565052 case Intrinsic::frameaddress:
123123 case ISD::RETURNADDR: return "RETURNADDR";
124124 case ISD::ADDROFRETURNADDR: return "ADDROFRETURNADDR";
125125 case ISD::FRAMEADDR: return "FRAMEADDR";
126 case ISD::SPONENTRY: return "SPONENTRY";
127126 case ISD::LOCAL_RECOVER: return "LOCAL_RECOVER";
128127 case ISD::READ_REGISTER: return "READ_REGISTER";
129128 case ISD::WRITE_REGISTER: return "WRITE_REGISTER";
34473447 }
34483448
34493449 updateValueMap(II, SrcReg);
3450 return true;
3451 }
3452 case Intrinsic::sponentry: {
3453 MachineFrameInfo &MFI = FuncInfo.MF->getFrameInfo();
3454
3455 // SP = FP + Fixed Object + 16
3456 MVT VT = TLI.getPointerTy(DL);
3457 int FI = MFI.CreateFixedObject(4, 0, false);
3458 unsigned ResultReg = createResultReg(TLI.getRegClassFor(VT));
3459 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
3460 TII.get(AArch64::ADDXri), ResultReg)
3461 .addFrameIndex(FI)
3462 .addImm(0)
3463 .addImm(0);
3464
3465 updateValueMap(II, ResultReg);
34663450 return true;
34673451 }
34683452 case Intrinsic::memcpy:
28622862 return LowerFP_EXTEND(Op, DAG);
28632863 case ISD::FRAMEADDR:
28642864 return LowerFRAMEADDR(Op, DAG);
2865 case ISD::SPONENTRY:
2866 return LowerSPONENTRY(Op, DAG);
28672865 case ISD::RETURNADDR:
28682866 return LowerRETURNADDR(Op, DAG);
28692867 case ISD::INSERT_VECTOR_ELT:
51705168 FrameAddr = DAG.getLoad(VT, DL, DAG.getEntryNode(), FrameAddr,
51715169 MachinePointerInfo());
51725170 return FrameAddr;
5173 }
5174
5175 SDValue AArch64TargetLowering::LowerSPONENTRY(SDValue Op,
5176 SelectionDAG &DAG) const {
5177 MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
5178
5179 EVT VT = getPointerTy(DAG.getDataLayout());
5180 SDLoc DL(Op);
5181 int FI = MFI.CreateFixedObject(4, 0, false);
5182 return DAG.getFrameIndex(FI, VT);
51835171 }
51845172
51855173 // FIXME? Maybe this could be a TableGen attribute on some registers and
616616 SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG) const;
617617 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;
618618 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
619 SDValue LowerSPONENTRY(SDValue Op, SelectionDAG &DAG) const;
620619 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
621620 SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
622621 SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
+0
-104
test/CodeGen/AArch64/sponentry.ll less more
None ; RUN: llc -mtriple=aarch64-windows-msvc -disable-fp-elim %s -o - | FileCheck %s
1 ; RUN: llc -mtriple=aarch64-windows-msvc -fast-isel -disable-fp-elim %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-windows-msvc %s -o - | FileCheck %s --check-prefix=NOFP
3 ; RUN: llc -mtriple=aarch64-windows-msvc -fast-isel %s -o - | FileCheck %s --check-prefix=NOFP
4
5 @env2 = common dso_local global [24 x i64]* null, align 8
6
7 define dso_local void @bar() {
8 %1 = call i8* @llvm.sponentry()
9 %2 = load [24 x i64]*, [24 x i64]** @env2, align 8
10 %3 = getelementptr inbounds [24 x i64], [24 x i64]* %2, i32 0, i32 0
11 %4 = bitcast i64* %3 to i8*
12 %5 = call i32 @_setjmpex(i8* %4, i8* %1) #2
13 ret void
14 }
15
16 ; CHECK: bar:
17 ; CHECK: mov x29, sp
18 ; CHECK: add x1, x29, #16
19 ; CEHCK: bl _setjmpex
20
21 ; NOFP: str x30, [sp, #-16]!
22 ; NOFP: add x1, sp, #16
23
24 define dso_local void @foo([24 x i64]*) {
25 %2 = alloca [24 x i64]*, align 8
26 %3 = alloca i32, align 4
27 %4 = alloca [100 x i32], align 4
28 store [24 x i64]* %0, [24 x i64]** %2, align 8
29 %5 = call i8* @llvm.sponentry()
30 %6 = load [24 x i64]*, [24 x i64]** %2, align 8
31 %7 = getelementptr inbounds [24 x i64], [24 x i64]* %6, i32 0, i32 0
32 %8 = bitcast i64* %7 to i8*
33 %9 = call i32 @_setjmpex(i8* %8, i8* %5)
34 store i32 %9, i32* %3, align 4
35 ret void
36 }
37
38 ; CHECK: foo:
39 ; CHECK: sub sp, sp, #448
40 ; CHECK: add x29, sp, #432
41 ; CHECK: add x1, x29, #16
42 ; CEHCK: bl _setjmpex
43
44 ; NOFP: sub sp, sp, #432
45 ; NOFP: add x1, sp, #432
46
47 define dso_local void @var_args(i8*, ...) {
48 %2 = alloca i8*, align 8
49 %3 = alloca i8*, align 8
50 store i8* %0, i8** %2, align 8
51 %4 = bitcast i8** %3 to i8*
52 call void @llvm.va_start(i8* %4)
53 %5 = load i8*, i8** %3, align 8
54 %6 = getelementptr inbounds i8, i8* %5, i64 8
55 store i8* %6, i8** %3, align 8
56 %7 = bitcast i8* %5 to i32*
57 %8 = load i32, i32* %7, align 8
58 %9 = bitcast i8** %3 to i8*
59 call void @llvm.va_end(i8* %9)
60 %10 = call i8* @llvm.sponentry()
61 %11 = load [24 x i64]*, [24 x i64]** @env2, align 8
62 %12 = getelementptr inbounds [24 x i64], [24 x i64]* %11, i32 0, i32 0
63 %13 = bitcast i64* %12 to i8*
64 %14 = call i32 @_setjmpex(i8* %13, i8* %10) #3
65 ret void
66 }
67
68 ; CHECK: var_args:
69 ; CHECK: sub sp, sp, #96
70 ; CHECK: add x29, sp, #16
71 ; CHECK: add x1, x29, #80
72 ; CEHCK: bl _setjmpex
73
74 ; NOFP: sub sp, sp, #96
75 ; NOFP: add x1, sp, #96
76
77 define dso_local void @manyargs(i64 %x1, i64 %x2, i64 %x3, i64 %x4, i64 %x5, i64 %x6, i64 %x7, i64 %x8, i64 %x9, i64 %x10) {
78 %1 = call i8* @llvm.sponentry()
79 %2 = load [24 x i64]*, [24 x i64]** @env2, align 8
80 %3 = getelementptr inbounds [24 x i64], [24 x i64]* %2, i32 0, i32 0
81 %4 = bitcast i64* %3 to i8*
82 %5 = call i32 @_setjmpex(i8* %4, i8* %1) #2
83 ret void
84 }
85
86 ; CHECK: manyargs:
87 ; CHECK: stp x29, x30, [sp, #-16]!
88 ; CHECK: add x1, x29, #16
89
90 ; NOFP: str x30, [sp, #-16]!
91 ; NOFP: add x1, sp, #16
92
93 ; Function Attrs: nounwind readnone
94 declare i8* @llvm.sponentry()
95
96 ; Function Attrs: returns_twice
97 declare dso_local i32 @_setjmpex(i8*, i8*)
98
99 ; Function Attrs: nounwind
100 declare void @llvm.va_start(i8*) #1
101
102 ; Function Attrs: nounwind
103 declare void @llvm.va_end(i8*) #1