OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [vect/] [fast-math-vect-8.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
! { dg-require-effective-target vect_float }
3
 
4
module solv_cap
5
 
6
  implicit none
7
 
8
  public  :: init_solve
9
 
10
  integer, parameter, public :: dp = 4
11
 
12
  real(kind=dp), private :: Pi, Mu0, c0, eps0
13
  logical,       private :: UseFFT, UsePreco
14
  real(kind=dp), private :: D1, D2
15
  integer,       private, save :: Ng1=0, Ng2=0
16
  integer,       private, pointer,     dimension(:,:)  :: Grid
17
  real(kind=dp), private, allocatable, dimension(:,:)  :: G
18
 
19
contains
20
 
21
  subroutine init_solve(Grid_in, GrSize1, GrSize2, UseFFT_in, UsePreco_in)
22
    integer, intent(in), target, dimension(:,:) :: Grid_in
23
    real(kind=dp), intent(in)  :: GrSize1, GrSize2
24
    logical,       intent(in)  :: UseFFT_in, UsePreco_in
25
    integer                    :: i, j
26
 
27
    Pi = acos(-1.0_dp)
28
    Mu0 = 4e-7_dp * Pi
29
    c0 = 299792458
30
    eps0 = 1 / (Mu0 * c0**2)
31
 
32
    UseFFT = UseFFT_in
33
    UsePreco = UsePreco_in
34
 
35
    if(Ng1 /= 0 .and. allocated(G) ) then
36
      deallocate( G )
37
    end if
38
 
39
    Grid => Grid_in
40
    Ng1 = size(Grid, 1)
41
    Ng2 = size(Grid, 2)
42
    D1 = GrSize1/Ng1
43
    D2 = GrSize2/Ng2
44
 
45
    allocate( G(0:Ng1,0:Ng2) )
46
 
47
    write(unit=*, fmt=*) "Calculating G"
48
    do i=0,Ng1
49
      do j=0,Ng2
50
        G(j,i) = Ginteg( -D1/2,-D2/2, D1/2,D2/2, i*D1,j*D2 )
51
      end do
52
    end do
53
 
54
    if(UseFFT) then
55
      write(unit=*, fmt=*) "Transforming G"
56
      call FourirG(G,1)
57
    end if
58
 
59
    return
60
 
61
 
62
  contains
63
  function Ginteg(xq1,yq1, xq2,yq2, xp,yp)  result(G)
64
    real(kind=dp), intent(in) :: xq1,yq1, xq2,yq2, xp,yp
65
    real(kind=dp)             :: G
66
    real(kind=dp)             :: x1,x2,y1,y2,t
67
    x1 = xq1-xp
68
    x2 = xq2-xp
69
    y1 = yq1-yp
70
    y2 = yq2-yp
71
 
72
    if (x1+x2 < 0) then
73
      t = -x1
74
      x1 = -x2
75
      x2 = t
76
    end if
77
    if (y1+y2 < 0) then
78
      t = -y1
79
      y1 = -y2
80
      y2 = t
81
    end if
82
 
83
    G = (x2*y2)-(x1*y2)-(x2*y1)+(x1*y1)
84
 
85
    return
86
  end function Ginteg
87
 
88
  end subroutine init_solve
89
 
90
end module solv_cap
91
 
92
 
93
! { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_intfloat_cvt } } }
94
! { dg-final { cleanup-tree-dump "vect" } }
95
! { dg-final { cleanup-modules "solv_cap" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.