Skip to content

Commit

Permalink
Merge pull request lcompilers#2704 from Vipul-Cariappa/dev
Browse files Browse the repository at this point in the history
removing _lfortran_caimag and _lfortran_zaimag functions
  • Loading branch information
Shaikh-Ubaid committed May 15, 2024
2 parents 8773842 + 2c302ec commit 5cf0594
Show file tree
Hide file tree
Showing 65 changed files with 1,232 additions and 1,264 deletions.
17 changes: 4 additions & 13 deletions src/runtime/lpython_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def abs(c: c32) -> f32:
a: f32
b: f32
a = c.real
b = _lfortran_caimag(c)
b = c.imag
return f32((a**f32(2) + b**f32(2))**f32(1/2))

@overload
def abs(c: c64) -> f64:
a: f64
b: f64
a = c.real
b = _lfortran_zaimag(c)
b = c.imag
return (a**2.0 + b**2.0)**(1/2)

@interface
Expand Down Expand Up @@ -434,22 +434,13 @@ def lbound(x: i32[:], dim: i32) -> i32:
def ubound(x: i32[:], dim: i32) -> i32:
pass


@ccall
def _lfortran_caimag(x: c32) -> f32:
pass

@ccall
def _lfortran_zaimag(x: c64) -> f64:
pass

@overload
def _lpython_imag(x: c64) -> f64:
return _lfortran_zaimag(x)
return x.imag

@overload
def _lpython_imag(x: c32) -> f32:
return _lfortran_caimag(x)
return x.imag


@overload
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-array_01_decl-39cf894.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_01_decl-39cf894.stdout",
"stdout_hash": "292194a8fe4110a90c90bbcbf94f66b70f82978e14108ded75104711",
"stdout_hash": "3a65f3ea0a230ad60dcabd62518f2ee3d52a8aa788fc1f7d3835ad72",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
134 changes: 67 additions & 67 deletions tests/reference/asr-array_01_decl-39cf894.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-array_02_decl-e8f6874.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_02_decl-e8f6874.stdout",
"stdout_hash": "7b506405f2db787df8d5e04ea40bb26baf200b5ea75a29f8410dcaaa",
"stdout_hash": "71ec0bc14f8e98abf82cd10195f0949c765bc136b357701653ef100b",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
98 changes: 49 additions & 49 deletions tests/reference/asr-array_02_decl-e8f6874.stdout

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_02-bc1a7ea.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-bindc_02-bc1a7ea.stdout",
"stdout_hash": "0b63ac37d3c2fadcacabe7c8c985e02c6d3db8f19f945ab2a88414f7",
"stdout_hash": "71473316455dc06eda99f7a7bcf0ac3ed2e6a69d0e1f0893d9a0c48f",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
48 changes: 24 additions & 24 deletions tests/reference/asr-bindc_02-bc1a7ea.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__main__global_stmts:
(Function
(SymbolTable
229
227
{

})
Expand Down Expand Up @@ -76,11 +76,11 @@
f:
(Function
(SymbolTable
228
226
{
y:
(Variable
228
226
y
[]
Local
Expand All @@ -101,7 +101,7 @@
),
yptr1:
(Variable
228
226
yptr1
[]
Local
Expand All @@ -124,7 +124,7 @@
),
yq:
(Variable
228
226
yq
[]
Local
Expand Down Expand Up @@ -157,14 +157,14 @@
[]
[]
[(Assignment
(Var 228 yq)
(Var 226 yq)
(PointerNullConstant
(CPtr)
)
()
)
(Assignment
(Var 228 y)
(Var 226 y)
(ArrayConstructor
[]
(Array
Expand All @@ -180,7 +180,7 @@
)
(Assignment
(ArrayItem
(Var 228 y)
(Var 226 y)
[(()
(IntegerConstant 0 (Integer 4))
())]
Expand All @@ -198,7 +198,7 @@
)
(Assignment
(ArrayItem
(Var 228 y)
(Var 226 y)
[(()
(IntegerConstant 1 (Integer 4))
())]
Expand All @@ -215,9 +215,9 @@
()
)
(Assignment
(Var 228 yptr1)
(Var 226 yptr1)
(GetPointer
(Var 228 y)
(Var 226 y)
(Pointer
(Array
(Integer 2)
Expand All @@ -232,7 +232,7 @@
)
(Print
[(GetPointer
(Var 228 y)
(Var 226 y)
(Pointer
(Array
(Integer 2)
Expand All @@ -243,13 +243,13 @@
)
()
)
(Var 228 yptr1)]
(Var 226 yptr1)]
()
()
)
(Print
[(ArrayItem
(Var 228 yptr1)
(Var 226 yptr1)
[(()
(IntegerConstant 0 (Integer 4))
())]
Expand All @@ -258,7 +258,7 @@
()
)
(ArrayItem
(Var 228 yptr1)
(Var 226 yptr1)
[(()
(IntegerConstant 1 (Integer 4))
())]
Expand All @@ -272,7 +272,7 @@
(Assert
(IntegerCompare
(ArrayItem
(Var 228 yptr1)
(Var 226 yptr1)
[(()
(IntegerConstant 0 (Integer 4))
())]
Expand All @@ -295,7 +295,7 @@
(Assert
(IntegerCompare
(ArrayItem
(Var 228 yptr1)
(Var 226 yptr1)
[(()
(IntegerConstant 1 (Integer 4))
())]
Expand All @@ -316,8 +316,8 @@
()
)
(CPtrToPointer
(Var 228 yq)
(Var 228 yptr1)
(Var 226 yq)
(Var 226 yptr1)
(ArrayConstant
[(IntegerConstant 2 (Integer 4))]
(Array
Expand All @@ -340,8 +340,8 @@
)
)
(Print
[(Var 228 yq)
(Var 228 yptr1)]
[(Var 226 yq)
(Var 226 yptr1)]
()
()
)]
Expand Down Expand Up @@ -405,11 +405,11 @@
main_program:
(Program
(SymbolTable
230
228
{
__main__global_stmts:
(ExternalSymbol
230
228
__main__global_stmts
2 __main__global_stmts
__main__
Expand All @@ -421,7 +421,7 @@
main_program
[__main__]
[(SubroutineCall
230 __main__global_stmts
228 __main__global_stmts
2 __main__global_stmts
[]
()
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-cast-435c233.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-cast-435c233.stdout",
"stdout_hash": "57cf8fa21e9a019ea1b4e9c13ecfc8500bd40140ab73e3706f4a548b",
"stdout_hash": "9d4368f1a04a24fa6209f6a540719cfeffe42ca14994adca08f2f8de",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
8 changes: 4 additions & 4 deletions tests/reference/asr-cast-435c233.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__main__global_stmts:
(Function
(SymbolTable
144
142
{

})
Expand Down Expand Up @@ -285,11 +285,11 @@
main_program:
(Program
(SymbolTable
145
143
{
__main__global_stmts:
(ExternalSymbol
145
143
__main__global_stmts
2 __main__global_stmts
__main__
Expand All @@ -301,7 +301,7 @@
main_program
[__main__]
[(SubroutineCall
145 __main__global_stmts
143 __main__global_stmts
2 __main__global_stmts
[]
()
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-complex1-f26c460.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-complex1-f26c460.stdout",
"stdout_hash": "187cdc6930877e015c5c561fcab7e91901fdf598059e5b81435617e3",
"stdout_hash": "ae33d701d4d343cafa7615c300a6c694a61b708244326bc8b0053ce2",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-complex1-f26c460.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@
main_program:
(Program
(SymbolTable
145
143
{

})
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-constants1-5828e8a.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-constants1-5828e8a.stdout",
"stdout_hash": "40a4972efc12a829102ca7c72203bfff3548b6a3dae12848310271a7",
"stdout_hash": "5fb0df2d4db52331b704c1654c77872bcfb83423b7d4911fb86fdf20",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-constants1-5828e8a.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@
main_program:
(Program
(SymbolTable
153
151
{

})
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-elemental_01-b58df26.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-elemental_01-b58df26.stdout",
"stdout_hash": "4c513521bada6163ac63fa332b183b73632bc0c1e8598ad0b75d8424",
"stdout_hash": "a0f93dd97eb3511199ce735fe6dc8dd0e08595a6b477816c65b1b4b7",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
Loading

0 comments on commit 5cf0594

Please sign in to comment.