diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-01 18:59:18 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-03 08:21:02 -0800 |
commit | cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab (patch) | |
tree | 843df1c1321bbc66e1bee850fa8513c54dd25dc8 /gcc/go | |
parent | 65af6bc9f87bc6b329fb7a16e3f736dd0a042bf5 (diff) | |
download | gcc-cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab.zip gcc-cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab.tar.gz gcc-cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab.tar.bz2 |
compiler: defer to middle-end for complex division
Go used to use slightly different semantics than C99 for complex division,
so we used runtime routines to handle the different. The gc compiler
has changes its behavior to match C99, so changes ours as well.
For golang/go#14644
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274213
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 21 | ||||
-rw-r--r-- | gcc/go/gofrontend/runtime.def | 6 |
3 files changed, 1 insertions, 28 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 183e5ca..f55daf7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6b01f8cdc11d86bd98165c91d6ae101bcf6b9e1a +5364d15082de77d2759a01f254208d4cb4f579e3 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 23caf61..50574c2 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -6979,27 +6979,6 @@ Binary_expression::do_get_backend(Translate_context* context) // been converted to a String_concat_expression in do_lower. go_assert(!left_type->is_string_type()); - // For complex division Go might want slightly different results than the - // backend implementation provides, so we have our own runtime routine. - if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) - { - Runtime::Function complex_code; - switch (this->left_->type()->complex_type()->bits()) - { - case 64: - complex_code = Runtime::COMPLEX64_DIV; - break; - case 128: - complex_code = Runtime::COMPLEX128_DIV; - break; - default: - go_unreachable(); - } - Expression* complex_div = - Runtime::make_call(complex_code, loc, 2, this->left_, this->right_); - return complex_div->get_backend(context); - } - Bexpression* left = this->left_->get_backend(context); Bexpression* right = this->right_->get_backend(context); diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def index 9a3c680..4b606a6 100644 --- a/gcc/go/gofrontend/runtime.def +++ b/gcc/go/gofrontend/runtime.def @@ -62,12 +62,6 @@ DEF_GO_RUNTIME(STRINGTOSLICERUNE, "runtime.stringtoslicerune", P2(POINTER, STRING), R1(SLICE)) -// Complex division. -DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", - P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) -DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", - P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) - // Make a slice. DEF_GO_RUNTIME(MAKESLICE, "runtime.makeslice", P3(TYPE, INT, INT), R1(POINTER)) |