-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang2] Generate loads of complex variables with correct alignment
flang2 calls the function make_load() to create various types of load instructions in the LLVM IR output. The function accepts a "flags" argument of type LL_InstrListFlags which should encode the alignment of the load, among other things. Apparently, for the IL_LDSCMPLX, IL_LDDCMPLX, and IL_LDQCMPLX opcodes, the flags had never been computed correctly. This patch makes such loads consistent with loads of other types, and also adds a test case.
- Loading branch information
Showing
2 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
! See https://llvm.org/LICENSE.txt for license information. | ||
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
! Check that load instructions are emitted with correct alignment. | ||
|
||
! RUN: %flang -S -emit-flang-llvm %s -o %t.ll | ||
! RUN: FileCheck %s < %t.ll | ||
|
||
! CHECK: load i8, ptr %in1, align 1 | ||
function bpass(in1) | ||
logical(kind=1) :: in1, bpass | ||
bpass = in1 | ||
end function bpass | ||
|
||
! CHECK: load i32, ptr %in1, align 4 | ||
function ipass(in1) | ||
integer(kind=4) :: in1, ipass | ||
ipass = in1 | ||
end function ipass | ||
|
||
! CHECK: load i64, ptr %in1, align 8 | ||
function lpass(in1) | ||
integer(kind=8) :: in1, lpass | ||
lpass = in1 | ||
end function lpass | ||
|
||
! CHECK: load float, ptr %in1, align 4 | ||
function fpass(in1) | ||
real(kind=4) :: in1, fpass | ||
fpass = in1 | ||
end function fpass | ||
|
||
! CHECK: load double, ptr %in1, align 8 | ||
function dpass(in1) | ||
real(kind=8) :: in1, dpass | ||
dpass = in1 | ||
end function dpass | ||
|
||
! CHECK: load <{float, float}>, ptr %in1, align 8 | ||
function cfpass(in1) | ||
complex(kind=4) :: in1, cfpass | ||
cfpass = in1 | ||
end function cfpass | ||
|
||
! CHECK: load <{double, double}>, ptr %in1, align 16 | ||
function cdpass(in1) | ||
complex(kind=8) :: in1, cdpass | ||
cdpass = in1 | ||
end function cdpass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters