@@ -973,7 +973,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
973
973
let llcast = PointerCast ( bcx, llcast, T_ptr ( T_i8 ( ) ) ) ;
974
974
call_memcpy ( bcx, llretptr, llcast, llsize_of ( ccx, lltp_ty) ) ;
975
975
}
976
- }
976
+ }
977
977
~"addr_of" => {
978
978
Store ( bcx, get_param ( decl, first_real_arg) , fcx. llretptr ) ;
979
979
}
@@ -1024,6 +1024,164 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
1024
1024
T_ptr ( T_nil ( ) ) ) ;
1025
1025
Store ( bcx, morestack_addr, fcx. llretptr ) ;
1026
1026
}
1027
+ ~"sqrtf32" => {
1028
+ let x = get_param ( decl, first_real_arg) ;
1029
+ let sqrtf = ccx. intrinsics . get ( ~"llvm. sqrt . f32 ") ;
1030
+ Store ( bcx, Call ( bcx, sqrtf, ~[ x] ) , fcx. llretptr ) ;
1031
+ }
1032
+ ~"sqrtf64" => {
1033
+ let x = get_param ( decl, first_real_arg) ;
1034
+ let sqrtf = ccx. intrinsics . get ( ~"llvm. sqrt . f64 ") ;
1035
+ Store ( bcx, Call ( bcx, sqrtf, ~[ x] ) , fcx. llretptr ) ;
1036
+ }
1037
+ ~"powif32" => {
1038
+ let a = get_param ( decl, first_real_arg) ;
1039
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1040
+ let powif = ccx. intrinsics . get ( ~"llvm. powi . f32 ") ;
1041
+ Store ( bcx, Call ( bcx, powif, ~[ a, x] ) , fcx. llretptr ) ;
1042
+ }
1043
+ ~"powif64" => {
1044
+ let a = get_param ( decl, first_real_arg) ;
1045
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1046
+ let powif = ccx. intrinsics . get ( ~"llvm. powi . f64 ") ;
1047
+ Store ( bcx, Call ( bcx, powif, ~[ a, x] ) , fcx. llretptr ) ;
1048
+ }
1049
+ ~"sinf32" => {
1050
+ let x = get_param ( decl, first_real_arg) ;
1051
+ let sinf = ccx. intrinsics . get ( ~"llvm. sin . f32 ") ;
1052
+ Store ( bcx, Call ( bcx, sinf, ~[ x] ) , fcx. llretptr ) ;
1053
+ }
1054
+ ~"sinf64" => {
1055
+ let x = get_param ( decl, first_real_arg) ;
1056
+ let sinf = ccx. intrinsics . get ( ~"llvm. sin . f64 ") ;
1057
+ Store ( bcx, Call ( bcx, sinf, ~[ x] ) , fcx. llretptr ) ;
1058
+ }
1059
+ ~"cosf32" => {
1060
+ let x = get_param ( decl, first_real_arg) ;
1061
+ let cosf = ccx. intrinsics . get ( ~"llvm. cos . f32 ") ;
1062
+ Store ( bcx, Call ( bcx, cosf, ~[ x] ) , fcx. llretptr ) ;
1063
+ }
1064
+ ~"cosf64" => {
1065
+ let x = get_param ( decl, first_real_arg) ;
1066
+ let cosf = ccx. intrinsics . get ( ~"llvm. cos . f64 ") ;
1067
+ Store ( bcx, Call ( bcx, cosf, ~[ x] ) , fcx. llretptr ) ;
1068
+ }
1069
+ ~"powf32" => {
1070
+ let a = get_param ( decl, first_real_arg) ;
1071
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1072
+ let powf = ccx. intrinsics . get ( ~"llvm. pow . f32 ") ;
1073
+ Store ( bcx, Call ( bcx, powf, ~[ a, x] ) , fcx. llretptr ) ;
1074
+ }
1075
+ ~"powf64" => {
1076
+ let a = get_param ( decl, first_real_arg) ;
1077
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1078
+ let powf = ccx. intrinsics . get ( ~"llvm. pow . f64 ") ;
1079
+ Store ( bcx, Call ( bcx, powf, ~[ a, x] ) , fcx. llretptr ) ;
1080
+ }
1081
+ ~"expf32" => {
1082
+ let x = get_param ( decl, first_real_arg) ;
1083
+ let expf = ccx. intrinsics . get ( ~"llvm. exp . f32 ") ;
1084
+ Store ( bcx, Call ( bcx, expf, ~[ x] ) , fcx. llretptr ) ;
1085
+ }
1086
+ ~"expf64" => {
1087
+ let x = get_param ( decl, first_real_arg) ;
1088
+ let expf = ccx. intrinsics . get ( ~"llvm. exp . f64 ") ;
1089
+ Store ( bcx, Call ( bcx, expf, ~[ x] ) , fcx. llretptr ) ;
1090
+ }
1091
+ ~"exp2f32" => {
1092
+ let x = get_param ( decl, first_real_arg) ;
1093
+ let exp2f = ccx. intrinsics . get ( ~"llvm. exp2 . f32 ") ;
1094
+ Store ( bcx, Call ( bcx, exp2f, ~[ x] ) , fcx. llretptr ) ;
1095
+ }
1096
+ ~"exp2f64" => {
1097
+ let x = get_param ( decl, first_real_arg) ;
1098
+ let exp2f = ccx. intrinsics . get ( ~"llvm. exp2 . f64 ") ;
1099
+ Store ( bcx, Call ( bcx, exp2f, ~[ x] ) , fcx. llretptr ) ;
1100
+ }
1101
+ ~"logf32" => {
1102
+ let x = get_param ( decl, first_real_arg) ;
1103
+ let logf = ccx. intrinsics . get ( ~"llvm. log . f32 ") ;
1104
+ Store ( bcx, Call ( bcx, logf, ~[ x] ) , fcx. llretptr ) ;
1105
+ }
1106
+ ~"logf64" => {
1107
+ let x = get_param ( decl, first_real_arg) ;
1108
+ let logf = ccx. intrinsics . get ( ~"llvm. log . f64 ") ;
1109
+ Store ( bcx, Call ( bcx, logf, ~[ x] ) , fcx. llretptr ) ;
1110
+ }
1111
+ ~"log10f32" => {
1112
+ let x = get_param ( decl, first_real_arg) ;
1113
+ let log10f = ccx. intrinsics . get ( ~"llvm. log10 . f32 ") ;
1114
+ Store ( bcx, Call ( bcx, log10f, ~[ x] ) , fcx. llretptr ) ;
1115
+ }
1116
+ ~"log10f64" => {
1117
+ let x = get_param ( decl, first_real_arg) ;
1118
+ let log10f = ccx. intrinsics . get ( ~"llvm. log10 . f64 ") ;
1119
+ Store ( bcx, Call ( bcx, log10f, ~[ x] ) , fcx. llretptr ) ;
1120
+ }
1121
+ ~"log2f32" => {
1122
+ let x = get_param ( decl, first_real_arg) ;
1123
+ let log2f = ccx. intrinsics . get ( ~"llvm. log2 . f32 ") ;
1124
+ Store ( bcx, Call ( bcx, log2f, ~[ x] ) , fcx. llretptr ) ;
1125
+ }
1126
+ ~"log2f64" => {
1127
+ let x = get_param ( decl, first_real_arg) ;
1128
+ let log2f = ccx. intrinsics . get ( ~"llvm. log2 . f64 ") ;
1129
+ Store ( bcx, Call ( bcx, log2f, ~[ x] ) , fcx. llretptr ) ;
1130
+ }
1131
+ ~"fmaf32" => {
1132
+ let a = get_param ( decl, first_real_arg) ;
1133
+ let b = get_param ( decl, first_real_arg + 1 u) ;
1134
+ let c = get_param ( decl, first_real_arg + 2 u) ;
1135
+ let fmaf = ccx. intrinsics . get ( ~"llvm. fma . f32 ") ;
1136
+ Store ( bcx, Call ( bcx, fmaf, ~[ a, b, c] ) , fcx. llretptr ) ;
1137
+ }
1138
+ ~"fmaf64" => {
1139
+ let a = get_param ( decl, first_real_arg) ;
1140
+ let b = get_param ( decl, first_real_arg + 1 u) ;
1141
+ let c = get_param ( decl, first_real_arg + 2 u) ;
1142
+ let fmaf = ccx. intrinsics . get ( ~"llvm. fma . f64 ") ;
1143
+ Store ( bcx, Call ( bcx, fmaf, ~[ a, b, c] ) , fcx. llretptr ) ;
1144
+ }
1145
+ ~"fabsf32" => {
1146
+ let x = get_param ( decl, first_real_arg) ;
1147
+ let fabsf = ccx. intrinsics . get ( ~"llvm. fabs . f32 ") ;
1148
+ Store ( bcx, Call ( bcx, fabsf, ~[ x] ) , fcx. llretptr ) ;
1149
+ }
1150
+ ~"fabsf64" => {
1151
+ let x = get_param ( decl, first_real_arg) ;
1152
+ let fabsf = ccx. intrinsics . get ( ~"llvm. fabs . f64 ") ;
1153
+ Store ( bcx, Call ( bcx, fabsf, ~[ x] ) , fcx. llretptr ) ;
1154
+ }
1155
+ ~"floorf32" => {
1156
+ let x = get_param ( decl, first_real_arg) ;
1157
+ let floorf = ccx. intrinsics . get ( ~"llvm. floor . f32 ") ;
1158
+ Store ( bcx, Call ( bcx, floorf, ~[ x] ) , fcx. llretptr ) ;
1159
+ }
1160
+ ~"floorf64" => {
1161
+ let x = get_param ( decl, first_real_arg) ;
1162
+ let floorf = ccx. intrinsics . get ( ~"llvm. floor . f64 ") ;
1163
+ Store ( bcx, Call ( bcx, floorf, ~[ x] ) , fcx. llretptr ) ;
1164
+ }
1165
+ ~"ceilf32" => {
1166
+ let x = get_param ( decl, first_real_arg) ;
1167
+ let ceilf = ccx. intrinsics . get ( ~"llvm. ceil . f32 ") ;
1168
+ Store ( bcx, Call ( bcx, ceilf, ~[ x] ) , fcx. llretptr ) ;
1169
+ }
1170
+ ~"ceilf64" => {
1171
+ let x = get_param ( decl, first_real_arg) ;
1172
+ let ceilf = ccx. intrinsics . get ( ~"llvm. ceil . f64 ") ;
1173
+ Store ( bcx, Call ( bcx, ceilf, ~[ x] ) , fcx. llretptr ) ;
1174
+ }
1175
+ ~"truncf32" => {
1176
+ let x = get_param ( decl, first_real_arg) ;
1177
+ let truncf = ccx. intrinsics . get ( ~"llvm. trunc . f32 ") ;
1178
+ Store ( bcx, Call ( bcx, truncf, ~[ x] ) , fcx. llretptr ) ;
1179
+ }
1180
+ ~"truncf64" => {
1181
+ let x = get_param ( decl, first_real_arg) ;
1182
+ let truncf = ccx. intrinsics . get ( ~"llvm. trunc . f64 ") ;
1183
+ Store ( bcx, Call ( bcx, truncf, ~[ x] ) , fcx. llretptr ) ;
1184
+ }
1027
1185
_ => {
1028
1186
// Could we make this an enum rather than a string? does it get
1029
1187
// checked earlier?
0 commit comments